如果只升级了版本号
但是这里没有写对应的升级Migrations
就会报错
Caused by: java.lang.IllegalStateException: A migration from 3 to 4 was required but not found. Please provide the necessary Migration path via RoomDatabase.Builder.addMigration(Migration ...) or allow for destructive migrations via one of the RoomDatabase.Builder.fallbackToDestructiveMigration* methods.
可以添加这句话
.addMigrations(MIGATION_1_2, MIGATION_2_3)
//出现异常问题 重建数据表,同时数据也会丢失。
.fallbackToDestructiveMigration()
.build();
//出现异常问题 重建数据表,同时数据也会丢失。
.fallbackToDestructiveMigration()