Skip to content

Commit

Permalink
Adds schedule_data json column (#13039)
Browse files Browse the repository at this point in the history
* Adds schedule_data json column

updates the version test thingy
schema dumped

* adds schema dump

* formatting
  • Loading branch information
supertopher committed May 20, 2022
1 parent 013a886 commit f106642
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void testBootloaderAppBlankDb() throws Exception {
val configsMigrator = new ConfigsDatabaseMigrator(configDatabase, configsFlyway);
// this line should change with every new migration
// to show that you meant to make a new migration to the prod database
assertEquals("0.36.3.001", configsMigrator.getLatestMigration().getVersion().getVersion());
assertEquals("0.38.4.001", configsMigrator.getLatestMigration().getVersion().getVersion());

val jobsPersistence = new DefaultJobPersistence(jobDatabase);
assertEquals(version, jobsPersistence.getVersion().get());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2021 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.db.instance.configs.migrations;

import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.jooq.DSLContext;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class V0_38_4_001__AddScheduleDataToConfigsTable extends BaseJavaMigration {

private static final Logger LOGGER = LoggerFactory.getLogger(V0_38_4_001__AddScheduleDataToConfigsTable.class);

@Override
public void migrate(final Context context) throws Exception {
LOGGER.info("Running migration: {}", this.getClass().getSimpleName());
final DSLContext ctx = DSL.using(context.getConnection());
addPublicColumn(ctx);
}

private static void addPublicColumn(final DSLContext ctx) {
ctx.alterTable("connection")
.addColumnIfNotExists(DSL.field(
"schedule_data",
SQLDataType.JSONB.nullable(true)))
.execute();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ create table "public"."connection"(
"updated_at" timestamptz(35) not null default null,
"source_catalog_id" uuid null,
"schedule_type" schedule_type null,
"schedule_data" jsonb null,
constraint "connection_pkey"
primary key ("id")
);
Expand Down

0 comments on commit f106642

Please sign in to comment.