I have an application and I’ve integrated room for storage. I have a database in the app module and I have a separate module/lib for developer environment selectors. I have a database in that module also.
However I have noticed that the database in both modules have the same name. This is causing data integrity issues as the db for the network module was introduced in the last release.
Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number. Expected identity hash: 40e26e7134224a73639f9d83df276f33, found: a8ce1bbdb059fa47182a881598adb8ff
So data that is in the application database is not currently accessible.
e.g.
@Provides
@Singleton
fun provideDeveloperEnvironmentDatabase(@ApplicationContext appContext: Context) :
DeveloperEnvironmentDatabase {
return Room.databaseBuilder(
appContext,
DeveloperEnvironmentDatabase::class.java,
"mobile_order_database"
).build()
}
and
@Provides
@Singleton
fun provideMobileOrderDatabase(@ApplicationContext appContext: Context) :
MobileOrderDatabase {
return Room.databaseBuilder(
appContext,
MobileOrderDatabase::class.java,
"mobile_order_database"
).build()
}
The content in my dev environment database isn’t essential and can be repopulated then next time devs/qa install the application. Is there any to handle this scenario for my next release to allow room to provide the data stored?
any help would be greatly appreciated. I tried to put in auto migrations in the dbs but that didn’t work. I would greatly appreciate it if someone more experienced than I in room could help