Skip to content

Commit

Permalink
fix: migration for columnProfiles (#2825)
Browse files Browse the repository at this point in the history
  • Loading branch information
mswertz authored Oct 5, 2023
1 parent b4c4514 commit 6437fd7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class MetadataUtils {
private static final Field<String[]> COLUMN_SEMANTICS =
field(name("columnSemantics"), VARCHAR.nullable(true).getArrayType());
private static final Field<String[]> COLUMN_PROFILES =
field(name("columnProfiles"), VARCHAR.nullable(true).getArrayType());
field(name("columnProfiles"), VARCHAR.nullable(true).getArrayType());
private static final Field<String> COLUMN_TYPE =
field(name("columnType"), VARCHAR.nullable(false));
private static final Field<Boolean> COLUMN_REQUIRED =
Expand Down Expand Up @@ -241,7 +241,6 @@ protected static void init(DSLContext j) {
COLUMN_CASCADE,
COLUMN_DESCRIPTION,
COLUMN_SEMANTICS,
COLUMN_PROFILES,
COLUMN_VISIBLE)
.constraints(
primaryKey(TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public class Migrations {
// version the current software needs to work
private static final int SOFTWARE_DATABASE_VERSION = 10;
private static final int SOFTWARE_DATABASE_VERSION = 11;
private static Logger logger = LoggerFactory.getLogger(Migrations.class);

public static synchronized void initOrMigrate(SqlDatabase db) {
Expand Down Expand Up @@ -83,6 +83,8 @@ public static synchronized void initOrMigrate(SqlDatabase db) {
if (version < 10)
executeMigrationFile(tdb, "migration10.sql", "add Aggregate role for each schema");

if (version < 11) executeMigrationFile(tdb, "migration11.sql", "add profile metadata");

// if success, update version to SOFTWARE_DATABASE_VERSION
updateDatabaseVersion((SqlDatabase) tdb, SOFTWARE_DATABASE_VERSION);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "MOLGENIS"."column_metadata"
ADD COLUMN IF NOT EXISTS "columnProfiles" VARCHAR[];

0 comments on commit 6437fd7

Please sign in to comment.