Made database handling a bit clearer
This commit is contained in:
parent
35624c0034
commit
3a39c0e64f
|
@ -27,14 +27,13 @@ fun main() = application {
|
|||
state = WindowState(position = WindowPosition(Alignment.Center), size = DpSize(1000.dp, 800.dp)),
|
||||
) {
|
||||
File("data/db").mkdirs()
|
||||
DI.setRepository(JdbcSqliteDriver("jdbc:sqlite:data/db/Bankmeister.db").apply {
|
||||
val schema = BankmeisterDb.Schema
|
||||
schema.synchronous().also {
|
||||
DI.setRepository(JdbcSqliteDriver("jdbc:sqlite:data/db/Bankmeister.db").also { driver ->
|
||||
BankmeisterDb.Schema.synchronous().also { schema ->
|
||||
if (File("data/db/Bankmeister.db").exists() == false) {
|
||||
it.create(this)
|
||||
schema.create(driver)
|
||||
}
|
||||
|
||||
it.migrate(this, schema.version, 4)
|
||||
schema.migrate(driver, schema.version, 1)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue