aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/database/Database.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-05-11 15:22:18 +0200
committerLinnea Gräf <nea@nea.moe>2024-05-11 16:43:20 +0200
commit71d7054571c6f7eca8c28b8f0bf396c16a28543c (patch)
tree4107f88b95977fb205ebe03b8ded2bba75a3c44f /src/main/kotlin/moe/nea/ledger/database/Database.kt
parent79fbb4e6f69df86e885464ddb84b163b90872eee (diff)
downloadLocalTransactionLedger-71d7054571c6f7eca8c28b8f0bf396c16a28543c.tar.gz
LocalTransactionLedger-71d7054571c6f7eca8c28b8f0bf396c16a28543c.tar.bz2
LocalTransactionLedger-71d7054571c6f7eca8c28b8f0bf396c16a28543c.zip
WIP custom dsl
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/database/Database.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/database/Database.kt23
1 files changed, 23 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
new file mode 100644
index 0000000..d14a0e2
--- /dev/null
+++ b/src/main/kotlin/moe/nea/ledger/database/Database.kt
@@ -0,0 +1,23 @@
+package moe.nea.ledger.database
+
+import java.sql.DriverManager
+
+object Database {
+ val connection = DriverManager.getConnection("jdbc:sqlite:money-ledger/database.db")
+
+ object MetaTable : Table("LedgerMeta") {
+ val key = column("key", DBString)
+ val value = column("value", DBString)
+
+ init {
+ unique(key)
+ }
+ }
+
+ fun init() {
+ MetaTable.createIfNotExists(connection)
+ val meta = MetaTable.selectAll(connection).associate { it[MetaTable.key] to it[MetaTable.value] }
+ println("Old Meta: $meta")
+ }
+
+} \ No newline at end of file