diff options
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/database/Database.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/ledger/database/Database.kt | 23 |
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 |