lundi 9 mai 2016

green dao update column on play store update has taken place

this is my Generator class

public class Generator {
    public static void main(String[] args) throws Exception {
        Schema schema = new Schema(1, "");

    private static void createAbcDB(Schema schema) throws IOException, Exception {
        Entity abc = schema.addEntity("Abc");

This is the code where i get abc dao from dao session. This works fine.

DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(SurveyActivity.this, "abc.db", null);
        SQLiteDatabase db = devOpenHelper.getWritableDatabase();
        DaoMaster daoMaster = new DaoMaster(db);
        DaoSession daoSession = daoMaster.newSession(IdentityScopeType.None);
        abcDao = daoSession.getAbcDao();

I added one more column


to createAbcDB in generator to new version of app. Once users get updated they are getting sql exception saying no column found. Because i am calling on new login

dropAllTables(db, true);

But problem is i have given one time login that user will always come to landing screen on upgrade from play store. So i don't know whether the user is upgraded app or not in order to drop and create all tables.

So my question is how to know my table has altered?

Aucun commentaire:

Enregistrer un commentaire