aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/database/Database.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-01-07 15:57:48 +0100
committerLinnea Gräf <nea@nea.moe>2025-01-07 15:57:48 +0100
commitdc19995f2b11ba595775b7224df200e365e7c4bf (patch)
tree0baee487f75db329c73e9125b030f0b6d5dd741b /src/main/kotlin/moe/nea/ledger/database/Database.kt
parent0ee8a4fdfedf20d543f42ab52a2f24af089271ac (diff)
downloadLocalTransactionLedger-dc19995f2b11ba595775b7224df200e365e7c4bf.tar.gz
LocalTransactionLedger-dc19995f2b11ba595775b7224df200e365e7c4bf.tar.bz2
LocalTransactionLedger-dc19995f2b11ba595775b7224df200e365e7c4bf.zip
refactor: Extract database to its own module
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/database/Database.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/database/Database.kt3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/database/Database.kt b/src/main/kotlin/moe/nea/ledger/database/Database.kt
index a77ea30..025888c 100644
--- a/src/main/kotlin/moe/nea/ledger/database/Database.kt
+++ b/src/main/kotlin/moe/nea/ledger/database/Database.kt
@@ -1,6 +1,7 @@
package moe.nea.ledger.database
import moe.nea.ledger.Ledger
+import moe.nea.ledger.database.columns.DBString
import java.sql.Connection
import java.sql.DriverManager
@@ -42,6 +43,8 @@ class Database {
val oldVersion = meta[MetaKey.DATABASE_VERSION]?.toLong() ?: -1
println("Old Database Version: $oldVersion; Current version: $databaseVersion")
+ if (oldVersion > databaseVersion)
+ error("Outdated software. Database is newer than me!")
// TODO: create a backup if there is a db version upgrade happening
DBUpgrade.performUpgradeChain(
connection, oldVersion, databaseVersion,