Room database migration if only new table is added

前端 未结 6 1097
不思量自难忘°
不思量自难忘° 2020-12-07 09:07

Let\'t assume, I have a simple Room database:

@Database(entities = {User.class}, version = 1)
abstract class AppDatabase extends RoomDatabase {
    public ab         


        
6条回答
  •  天涯浪人
    2020-12-07 09:48

    Sorry, Room doesn't support auto-creation of tables without data loss.

    It is mandatory to write the migration. Otherwise, it'll erase all the data and create the new table structure.

提交回复
热议问题