Java Android机房变更表java.lang.IllegalStateException:迁移未正确处理

时间:2019-09-04 06:14:49

标签: java android android-room

我想在现有表中添加列:

 static final Migration MIGRATION_33_35 = new Migration(33, 35) {
        @Override
        public void migrate(SupportSQLiteDatabase database) {
            database.execSQL("ALTER TABLE 'Orders' " + " ADD COLUMN 'lats' REAL  ");

        }
    };
private static DbManager buildDatabaseInstance(Context context) {
    return Room.databaseBuilder(context,
            DbManager.class,
            DB_NAME)
            .addMigrations(MIGRATION_31_32,MIGRATION_33_35)//nazwa powinna byc 32_33
            .allowMainThreadQueries().build();
}

我不想丢失行中有数据的数据。 现在我有了这个:

java.lang.IllegalStateException: Migration didn't properly handle table

0 个答案:

没有答案