我想在现有表中添加列:
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