Skip to content

Commit 38e8663

Browse files
authored
migrate during initialize dbos (#22)
Move migration to initialize before systemDB creates the datasource
1 parent 2b55b61 commit 38e8663

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/main/java/dev/dbos/transact/DBOS.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public static synchronized DBOS initialize(DBOSConfig config) {
7373
if (instance != null) {
7474
throw new IllegalStateException("DBOS has already been initialized.");
7575
}
76+
if (config.migration()) {
77+
MigrationManager.runMigrations(config);
78+
}
7679
instance = new DBOS(config);
7780
return instance ;
7881
}
@@ -86,6 +89,9 @@ public static synchronized DBOS initialize(DBOSConfig config, SystemDatabase sd,
8689
throw new IllegalArgumentException("Config, systemdb, dbosexecutor cannot be null");
8790
}
8891

92+
if (config.migration()) {
93+
MigrationManager.runMigrations(config);
94+
}
8995
instance = new DBOS(config, sd, de, q, ss);
9096
return instance ;
9197
}
@@ -210,11 +216,7 @@ public Queue build() {
210216
}
211217
}
212218
public void launch() {
213-
214-
if (config.migration()) {
215-
MigrationManager.runMigrations(config);
216-
}
217-
219+
218220
queueService.start();
219221

220222
schedulerService.start();

0 commit comments

Comments
 (0)