I am trying to learn about DBFlow, because in the project that I am working right now, the previous guy decided to use it. So in the database class I have this:
@Database(name = ConstructDB.NAME, version = ConstructDB.VERSION)
public class ConstructDB {
public static final String NAME = "construct_v3";
public static final int VERSION = 18;
@Migration(version = 17, database = ConstructDB.class)
public static class Migration17 extends AlterTableMigration<Task> {
public Migration17(Class<Task> table) {
super(table);
}
@Override
public void onPreMigrate() {
super.onPreMigrate();
addColumn(SQLiteType.INTEGER, NAMES.DB.READ_COUNT);
}
}
}
This is the previous migration script. So right now I want to add a new column to this same table. I did the required changes in the table class (like adding the column, the set and get method, etc). And I want to write a new script to accept my changes. So I did this:
@Database(name = ConstructDB.NAME, version = ConstructDB.VERSION)
public class ConstructDB {
public static final String NAME = "construct_v3";
public static final int VERSION = 19;
@Migration(version = 18, database = ConstructDB.class)
public static class Migration18 extends AlterTableMigration<Task> {
public Migration18(Class<Task> table) {
super(table);
}
@Override
public void onPreMigrate() {
super.onPreMigrate();
addColumn(SQLiteType.TEXT, NAMES.DB.CATEGORY_ID);
}
}
}
But when I run the project I get lots of errors like:
error: cannot find symbol
import com.construct.v2.dagger.DaggerConstructComponent;
And mostly errors like this (something_table, which are all the tables in my database. This _table files are under the build folder and they are not to be edited):
error: cannot find symbol
import com.construct.v2.models.Attachment_Table;
If I return to the state I had before my changes (in the Task model and the migration script) the code runs just fine. So I think I am doing something wrong or skipping some step. How do I run the migration script? What other changes do I need to make?