Skip to content

Commit 74792c1

Browse files
authored
Add unsupported_protocol_version column to Connection (#18876)
1 parent 589f6ef commit 74792c1

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

airbyte-bootloader/src/test/java/io/airbyte/bootloader/BootloaderAppTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void testBootloaderAppBlankDb() throws Exception {
141141
val configsMigrator = new ConfigsDatabaseMigrator(configDatabase, configsFlyway);
142142
// this line should change with every new migration
143143
// to show that you meant to make a new migration to the prod database
144-
assertEquals("0.40.12.001", configsMigrator.getLatestMigration().getVersion().getVersion());
144+
assertEquals("0.40.18.001", configsMigrator.getLatestMigration().getVersion().getVersion());
145145

146146
val jobsPersistence = new DefaultJobPersistence(jobDatabase);
147147
assertEquals(VERSION_0330_ALPHA, jobsPersistence.getVersion().get());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
3+
*/
4+
5+
package io.airbyte.db.instance.configs.migrations;
6+
7+
import org.flywaydb.core.api.migration.BaseJavaMigration;
8+
import org.flywaydb.core.api.migration.Context;
9+
import org.jooq.DSLContext;
10+
import org.jooq.impl.DSL;
11+
import org.jooq.impl.SQLDataType;
12+
import org.slf4j.Logger;
13+
import org.slf4j.LoggerFactory;
14+
15+
public class V0_40_18_001__AddInvalidProtocolFlagToConnections extends BaseJavaMigration {
16+
17+
private static final Logger LOGGER = LoggerFactory.getLogger(V0_40_18_001__AddInvalidProtocolFlagToConnections.class);
18+
19+
@Override
20+
public void migrate(final Context context) throws Exception {
21+
LOGGER.info("Running migration: {}", this.getClass().getSimpleName());
22+
23+
// Warning: please do not use any jOOQ generated code to write a migration.
24+
// As database schema changes, the generated jOOQ code can be deprecated. So
25+
// old migration may not compile if there is any generated code.
26+
final DSLContext ctx = DSL.using(context.getConnection());
27+
addInvalidProtocolFlagToConnections(ctx);
28+
}
29+
30+
private void addInvalidProtocolFlagToConnections(final DSLContext ctx) {
31+
ctx.alterTable("connection")
32+
.addColumn(DSL.field("unsupported_protocol_version", SQLDataType.BOOLEAN.nullable(false).defaultValue(false)))
33+
.execute();
34+
}
35+
36+
}

airbyte-db/db-lib/src/main/resources/configs_database/schema_dump.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ create table "public"."connection"(
108108
"notify_schema_changes" bool not null default true,
109109
"non_breaking_change_preference" varchar(7) not null default '''ignore''::character varying',
110110
"breaking_change" bool not null default false,
111+
"unsupported_protocol_version" bool not null default false,
111112
constraint "connection_pkey"
112113
primary key ("id")
113114
);

0 commit comments

Comments
 (0)