use of com.orm.androrm.impl.migration.NewEmptyModel in project androrm by androrm.
the class RenameModelMigrationTest method testRenameTable.
public void testRenameTable() {
Migrator<NewEmptyModel> migrator = new Migrator<NewEmptyModel>(NewEmptyModel.class);
assertTrue(mHelper.tableExists(EmptyModel.class));
EmptyModel model1 = new EmptyModel();
model1.save(getContext());
assertEquals(1, EmptyModel.objects(getContext()).count());
assertEquals(0, NewEmptyModel.objects(getContext()).count());
migrator.renameModel("EmptyModel", NewEmptyModel.class);
migrator.migrate(getContext());
assertFalse(mHelper.tableExists(EmptyModel.class));
assertEquals(1, NewEmptyModel.objects(getContext()).count());
Filter filter = new Filter();
filter.is("mModel", "newemptymodel").is("mAction", "rename_table").is("mValue", "newemptymodel");
assertEquals(1, Migration.objects(getContext()).filter(filter).count());
}
Aggregations