Home > Software engineering >  How can I reset room db database schema if I don't want to increment the version?
How can I reset room db database schema if I don't want to increment the version?

Time:06-25

My app is getting the following error:

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.

I don't want to increase the version since the app I'm developing is not yet released. What should I do to prevent this error?

CodePudding user response:

Just clear the app data after changing the schema.

CodePudding user response:

If you do not care about the existing data in the Room DB, you can clear the tables like this:

viewModelScope.launch {
    yourRoomDBInstance.clearAllTables()
} 
  • Related