I am using GreenDAO in my android project. I see a problem in GreenDAO. whenever I make changes to the existing tables and change the version to migrate the changes, GreenDAOis deleting all the tables. I tried to make changes in the GreenDAOgenerated files but it is not going to be the correct procedure and it did not work, however.
@Override
public void onUpgrade(Database db, int oldVersion, int newVersion) {
Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
dropAllTables(db, true);
onCreate(db);
}
I tried to comment dropAllTables in above code it did not work, the code is regenerating on running the code? Does anybody know how to fix it?
EDIT:
I saw few questions related to this problem but they are OLD threads did not help me.
You can extend
DaoMaster.DevOpenHelperand provide your own implementation ofonUpgrade.For more details, checkout how I did it here.