Search code examples
androidandroid-sqliteandroid-room

Do I need to increment the Room Database version number if I only changed the DAO's, not the entities?


I was just wondering if you really need to increment the room database version number if you changed only the Data Access Objects (DAO's).

So the scenario is:

  1. I already published the app in the Play Store with version x
  2. I only changed part of some DAO's without changing the entities themselves
  3. I incremented the app version code and name (maybe unrelated)

Do I need to increment the room database version number?


Solution

  • Do I need to increment the room database version number?

    You need to increment the schema version when you change the schema. Simply adding functions to a DAO should not result in a schema change. However, your schema might change by things beyond your DAO and your entities. Right now, I think only @DatabaseView would have that effect in terms of annotations, and I do not see anything in RoomDatabase.Builder that should have an effect (other than addMigrations(), which specifically is for version number changes).