I have created 2 seperate room databases following best practices in kotlin. 1 database for age and 1 for gender, how can I merge these 2 databases and represent them into "1" database? The order from top to bottom does not matter. How can this be achieved this?
Age database: https://gyazo.com/0074f2e4f002de9a3ad07ec593a826d4
Gender database: https://gyazo.com/c8b800b8f2f4fc6b43a9de2ddfdb1e7d
Any advice is appreciated!
My age database:
@Database(entities = [Age::class], version = 1, exportSchema = false)
abstract class AgeDb : RoomDatabase() {
abstract fun AgeDao() : AgeDao
companion object {
@Volatile
private var INSTANCE : AgeDb? = null
fun getDatabase(context: Context) : AgeDb {
val tempInstance = INSTANCE
if (tempInstance != null) {
return tempInstance
}
synchronized(this) {
val instance = Room.databaseBuilder(
context.applicationContext,
AgeDb::class.java,
"dropdown_age"
).build()
INSTANCE = instance
return instance
}
}
}
}