YokanRoomDatabase.android.kt
composeApp/src/androidMain/kotlin/eu/friedcutlet/yokan/database/room/YokanRoomDatabase.android.kt
1package eu.friedcutlet.yokan.database.room23import androidx.room.Room4import eu.friedcutlet.yokan.AndroidAppContext56actual fun createYokanRoomDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanRoomDatabase {7 val ctx = AndroidAppContext.appContext8 ?: error("AndroidAppContext.appContext not initialized; call before opening Room.")9 val dbFile = ctx.getDatabasePath(eu.friedcutlet.yokan.domain.ProfileStorageNamespace(profileId).databaseRelativePath).apply { parentFile?.mkdirs() }10 return Room.databaseBuilder<YokanRoomDatabase>(11 context = ctx.applicationContext,12 name = dbFile.absolutePath,13 ).buildYokanRoom()14}15