Fixed creating database if it does not exist yet

This commit is contained in:
dankito 2024-09-09 00:06:32 +02:00
parent ce41ac682c
commit d25802f3bb
1 changed files with 8 additions and 1 deletions

View File

@ -28,7 +28,14 @@ fun main() = application {
) {
File("data/db").mkdirs()
DI.setRepository(JdbcSqliteDriver("jdbc:sqlite:data/db/Bankmeister.db").apply {
val schema = BankmeisterDb.Schema.synchronous().migrate(this, BankmeisterDb.Schema.version, 4)
val schema = BankmeisterDb.Schema
schema.synchronous().also {
if (File("data/db/Bankmeister.db").exists() == false) {
it.create(this)
}
it.migrate(this, schema.version, 4)
}
})
App()