diff options
author | Linnea Gräf <nea@nea.moe> | 2024-10-05 11:15:30 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-10-05 11:15:30 +0200 |
commit | c689c21f3757faaa43afa2402e9e49a06c1e894f (patch) | |
tree | f02702a8f6b1f83513458d0808f47a71eff13099 /src/main/kotlin/moe/nea/ledger/database/Database.kt | |
parent | 71d7054571c6f7eca8c28b8f0bf396c16a28543c (diff) | |
download | LocalTransactionLedger-c689c21f3757faaa43afa2402e9e49a06c1e894f.tar.gz LocalTransactionLedger-c689c21f3757faaa43afa2402e9e49a06c1e894f.tar.bz2 LocalTransactionLedger-c689c21f3757faaa43afa2402e9e49a06c1e894f.zip |
Add last launch meta
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/database/Database.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/ledger/database/Database.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/database/Database.kt b/src/main/kotlin/moe/nea/ledger/database/Database.kt index d14a0e2..633b3a0 100644 --- a/src/main/kotlin/moe/nea/ledger/database/Database.kt +++ b/src/main/kotlin/moe/nea/ledger/database/Database.kt @@ -17,7 +17,12 @@ object Database { fun init() { MetaTable.createIfNotExists(connection) val meta = MetaTable.selectAll(connection).associate { it[MetaTable.key] to it[MetaTable.value] } - println("Old Meta: $meta") + val lastLaunch = meta["lastLaunch"]?.toLong() ?: 0L + println("Last launch $lastLaunch") + MetaTable.insert(connection, Table.OnConflict.REPLACE) { + it[MetaTable.key] = "lastLaunch" + it[MetaTable.value] = System.currentTimeMillis().toString() + } } }
\ No newline at end of file |