Why My `SQL Delight's` Todo notes app are not pers...
# compose-desktop
s
Why My
SQL Delight's
Todo notes app are not persisting data when I install My
Desktop Compose  App
as
DMG
file on my
M1 Macbook
? But everything works fine on my dev machine.
Flow 👇
Create new note
->
save it
->
close the app
->
Reopen again (My notes are not showing up!)
g
How do you create your database? Looks that you use in-memory db
s
Copy code
object DriverFactory {
    fun createDriver(): SqlDriver {
        val driver: SqlDriver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
        MoonbowDatabase.Schema.create(driver)
        return driver
    }
}
Yes i’m using In-Memory database. But I also tried this 👇
Copy code
fun MoonbowDatabaseDriver(): SqlDriver {
    val databasePath = File(System.getProperty("java.io.tmpdir"), "Moonbow.db")
    val driver = JdbcSqliteDriver(url = "jdbc:sqlite:${databasePath.absolutePath}")
    MoonbowDatabase.Schema.create(driver)
    return driver
}
g
It's expected for in memory of course But why do you use temp directory in second case? Instead use some explicit, non-temporary dir, usually desktop apps keep it in user configs dir (depending on platform)
👍 1