|
@@ -6,7 +6,7 @@ import androidx.room.Room
|
|
|
import androidx.room.RoomDatabase
|
|
import androidx.room.RoomDatabase
|
|
|
|
|
|
|
|
@Database(
|
|
@Database(
|
|
|
- entities = [QuestionsBean::class, DoctorBean::class, VoicePlayerBean::class, GameSoundBean::class],
|
|
|
|
|
|
|
+ entities = [QuestionsBean::class, DoctorBean::class, VoicePlayerBean::class, GameSoundBean::class, DepartmentBean::class],
|
|
|
version = 1
|
|
version = 1
|
|
|
)
|
|
)
|
|
|
abstract class AppDataBase : RoomDatabase() {
|
|
abstract class AppDataBase : RoomDatabase() {
|
|
@@ -19,6 +19,8 @@ abstract class AppDataBase : RoomDatabase() {
|
|
|
|
|
|
|
|
abstract fun getGameSoundDao(): GameSoundDao
|
|
abstract fun getGameSoundDao(): GameSoundDao
|
|
|
|
|
|
|
|
|
|
+ abstract fun getDepartmentDao(): DepartmentDao
|
|
|
|
|
+
|
|
|
companion object {
|
|
companion object {
|
|
|
@Volatile
|
|
@Volatile
|
|
|
private var sInstance: AppDataBase? = null
|
|
private var sInstance: AppDataBase? = null
|
|
@@ -38,11 +40,8 @@ abstract class AppDataBase : RoomDatabase() {
|
|
|
|
|
|
|
|
private fun createInstance(context: Context): AppDataBase {
|
|
private fun createInstance(context: Context): AppDataBase {
|
|
|
return Room.databaseBuilder(
|
|
return Room.databaseBuilder(
|
|
|
- context,
|
|
|
|
|
- AppDataBase::class.java,
|
|
|
|
|
- DATA_BASE_NAME
|
|
|
|
|
- ).allowMainThreadQueries()
|
|
|
|
|
- .build()
|
|
|
|
|
|
|
+ context, AppDataBase::class.java, DATA_BASE_NAME
|
|
|
|
|
+ ).allowMainThreadQueries().build()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|