Shageldi Alyyev
03/06/2025, 6:33 AMfun getDatabase(ctx: Context): AppDatabase {
val dbFile = ctx.getDatabasePath(dbFileName)
return Room.databaseBuilder<AppDatabase>(
context = ctx,
name = dbFile.absolutePath,
)
.setDriver(BundledSQLiteDriver())
.setQueryCoroutineContext(<http://Dispatchers.IO|Dispatchers.IO>)
.fallbackToDestructiveMigration(true)
.enableMultiInstanceInvalidation()
.allowMainThreadQueries()
.build()
}
actual fun platformModule(context: Any?) = module {
single<AppDatabase> { getDatabase(context as Context) }
}