Room Database setup

This commit is contained in:
Kgothatso Ngako
2026-03-26 00:20:20 +02:00
parent f8e7a20b98
commit 3dea688eea
16 changed files with 242 additions and 50 deletions

View File

@@ -0,0 +1,3 @@
package ac.aux.compose
actual class PlatformContext

View File

@@ -0,0 +1,16 @@
package ac.aux.compose.database.builder
import ac.aux.compose.PlatformContext
import ac.aux.compose.database.AuxDatabase
import androidx.room.Room
import androidx.room.RoomDatabase
import java.io.File
actual object PlatformDatabaseBuilder {
actual fun getDatabaseBuilder(platformContext: PlatformContext): RoomDatabase.Builder<AuxDatabase> {
val dbFile = File(System.getProperty("java.io.tmpdir"), "aux.db") // TODO: Stop using tmpDir on desktop...
return Room.databaseBuilder<AuxDatabase>(
name = dbFile.absolutePath,
)
}
}