Skip to content

Commit f106642

Browse files
authored
Adds schedule_data json column (#13039)
* Adds schedule_data json column updates the version test thingy schema dumped * adds schema dump * formatting
1 parent 013a886 commit f106642

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void testBootloaderAppBlankDb() throws Exception {
128128
val configsMigrator = new ConfigsDatabaseMigrator(configDatabase, configsFlyway);
129129
// this line should change with every new migration
130130
// to show that you meant to make a new migration to the prod database
131-
assertEquals("0.36.3.001", configsMigrator.getLatestMigration().getVersion().getVersion());
131+
assertEquals("0.38.4.001", configsMigrator.getLatestMigration().getVersion().getVersion());
132132

133133
val jobsPersistence = new DefaultJobPersistence(jobDatabase);
134134
assertEquals(version, jobsPersistence.getVersion().get());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2021 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_38_4_001__AddScheduleDataToConfigsTable extends BaseJavaMigration {
16+
17+
private static final Logger LOGGER = LoggerFactory.getLogger(V0_38_4_001__AddScheduleDataToConfigsTable.class);
18+
19+
@Override
20+
public void migrate(final Context context) throws Exception {
21+
LOGGER.info("Running migration: {}", this.getClass().getSimpleName());
22+
final DSLContext ctx = DSL.using(context.getConnection());
23+
addPublicColumn(ctx);
24+
}
25+
26+
private static void addPublicColumn(final DSLContext ctx) {
27+
ctx.alterTable("connection")
28+
.addColumnIfNotExists(DSL.field(
29+
"schedule_data",
30+
SQLDataType.JSONB.nullable(true)))
31+
.execute();
32+
}
33+
34+
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ create table "public"."connection"(
102102
"updated_at" timestamptz(35) not null default null,
103103
"source_catalog_id" uuid null,
104104
"schedule_type" schedule_type null,
105+
"schedule_data" jsonb null,
105106
constraint "connection_pkey"
106107
primary key ("id")
107108
);

0 commit comments

Comments
 (0)