Created
June 16, 2024 15:57
-
-
Save sajjadyousefnia/657054579899cc6f3afcff90eebb3442 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Database( | |
entities = [MdlMovie::class, MdlLastPlay::class], | |
version = 16, exportSchema = false | |
) | |
@TypeConverters(Converters::class) | |
abstract class RoomDB : RoomDatabase() { | |
abstract fun appDao(): AppDao | |
companion object { | |
private var INSTANCE: RoomDB? = null | |
fun getDatabase(context: Context): RoomDB { | |
if (INSTANCE == null) { | |
synchronized(RoomDB::class.java) { | |
if (INSTANCE == null) { | |
INSTANCE = Room.databaseBuilder(context.applicationContext, RoomDB::class.java, "sands_db") | |
.fallbackToDestructiveMigration() | |
//.addTypeConverter(converterFactory) | |
.allowMainThreadQueries() | |
.build() | |
} | |
} | |
} | |
return INSTANCE!! | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment