android中数据库删除列,如何删除Android下一版空间数据库中的列?

如何删除下一版本的房间数据库

android.DROp或删除不工作的列.?

@Database(entities = {User.class,AdTime.class},version = 1,exportSchema = false)

public abstract class AppDataBase extends RoomDatabase {

private static AppDataBase INSTANCE;

public abstract UserDao userModel();

public abstract AdDao adModel();

public static AppDataBase getInMemoryDatabase(Context context) {

if (INSTANCE == null) {

INSTANCE = Room.databaseBuilder(context,AppDataBase.class,"adrider")

// To simplify the codelab,allow queries on the main thread.

// Don't do this on a real app! See PersistenceBasicSample for an example.

.allowMainThreadQueries()

// .addMigrations(MIGRATION_1_2)

// .fallbackToDestructiveMigration()

.build();

}

return INSTANCE;

}

static final Migration MIGRATION_1_2=new Migration(1,2) {

@Override

public void migrate(@NonNull SupportSQLiteDatabase database) {

database.execSQL("ALTER TABLE User "

+ "DROP Download");

}

};

}

你可能感兴趣的:(android中数据库删除列)