From dc19995f2b11ba595775b7224df200e365e7c4bf Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Tue, 7 Jan 2025 15:57:48 +0100 Subject: refactor: Extract database to its own module --- src/main/kotlin/moe/nea/ledger/database/Database.kt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main/kotlin/moe/nea/ledger/database/Database.kt') 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, -- cgit