Skip to content

Commit 779766c

Browse files
committed
patched Java-based migration
Java-based migrations run out-of-order and can't conflict with the lastest SQL-based migrations
1 parent 27c1dfc commit 779766c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/org/breedinginsight/db/migration/V1_32_0__Set_Dev_Admin_Email.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ private void addConstraint(Context context) throws SQLException {
7878

7979
// Add new constraint
8080
try (Statement altTable = context.getConnection().createStatement()) {
81+
// NOTE: because Java-based migrations don't run at build time, they end up running last (out of order) on
82+
// application startup. If they haven't been applied to the database already. For that reason, the reference
83+
// to column `orcid` was changed to `oauth_id` 2025-08-25 to allow this migration to run after
84+
// V1.34.0__rename-orcid.sql.
8185
String sql = "ALTER TABLE bi_user\n" +
82-
"ADD CONSTRAINT " +CONSTRAINT_NAME+ " CHECK ( (email IS NOT NULL ) OR (orcid IS NULL) ) ;";
86+
"ADD CONSTRAINT " +CONSTRAINT_NAME+ " CHECK ( (email IS NOT NULL ) OR (oauth_id IS NULL) ) ;";
8387
log.debug(sql);
8488
altTable.executeUpdate(sql);
8589
}

0 commit comments

Comments
 (0)