Skip to content

Commit 4dfa4e1

Browse files
committed
Added migration successful check
Signed-off-by: Arnau Mora <[email protected]>
1 parent f48bda8 commit 4dfa4e1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/kotlin/com/arnyminerz/escalaralcoiaicomtat/backend/ServerDatabase.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class ServerDatabase private constructor() {
8383
SchemaUtils.create(Areas, Zones, Sectors, Paths, BlockingTable, InfoTable)
8484

8585
if (isFirstRun) {
86+
Logger.info("First boot. Setting database version...")
8687
DatabaseVersion.update(Migrations.DATABASE_VERSION)
8788
}
8889

src/main/kotlin/com/arnyminerz/escalaralcoiaicomtat/backend/database/migration/Migrations.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ object Migrations {
1919
}
2020
migration.performMigration()
2121

22-
currentVersion = DatabaseVersion.get()
22+
val newVersion = DatabaseVersion.get()
23+
require(newVersion != currentVersion) { "Migration unsuccessful" }
24+
currentVersion = newVersion
2325
}
2426
Logger.info("Database is up to date.")
2527
}

0 commit comments

Comments
 (0)