mirror of
https://github.com/dzeiocom/OpenHealth.git
synced 2025-06-07 15:29:55 +00:00
misc: Add more templating code
This commit is contained in:
parent
14102f65ae
commit
e69b2cb587
@ -18,6 +18,9 @@ import com.dzeio.openhealth.data.weight.WeightDao
|
|||||||
exportSchema = false
|
exportSchema = false
|
||||||
)
|
)
|
||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
|
|
||||||
|
// private val PREPOPULATE_DATA = listOf(Thing("1", "val"), Thing("2", "val 2"))
|
||||||
|
|
||||||
abstract fun weightDao(): WeightDao
|
abstract fun weightDao(): WeightDao
|
||||||
abstract fun waterDao(): WaterDao
|
abstract fun waterDao(): WaterDao
|
||||||
|
|
||||||
@ -38,18 +41,16 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
// https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1#4785
|
// https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1#4785
|
||||||
private fun buildDatabase(context: Context): AppDatabase {
|
private fun buildDatabase(context: Context): AppDatabase {
|
||||||
return Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME)
|
return Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME)
|
||||||
// .addCallback(
|
// .addCallback(object : Callback() {
|
||||||
// object : RoomDatabase.Callback() {
|
// override fun onCreate(db: SupportSQLiteDatabase) {
|
||||||
// override fun onCreate(db: SupportSQLiteDatabase) {
|
// super.onCreate(db)
|
||||||
// super.onCreate(db)
|
// // moving to a new thread
|
||||||
// val request = OneTimeWorkRequestBuilder<SeedDatabaseWorker>()
|
// Executors.newSingleThreadExecutor().execute {
|
||||||
// .setInputData(workDataOf(KEY_FILENAME to PLANT_DATA_FILENAME))
|
// getInstance(context).thingDao()
|
||||||
// .build()
|
// .insert(PREPOPULATE_DATA)
|
||||||
// WorkManager.getInstance(context).enqueue(request)
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// )
|
// })
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user