Using onUpgrade in SQLiteOpenHelper, i can alter the table and new column name with a default value is added.
But when i access that particular table inside the activity,it shows only the old column count.As per alteration,it should display 4 (column count).But it shows 3 Only.
My code inside onUpgrade method:
db.execSQL("ALTER TABLE " + MyTableDaoDao.TABLENAME + " ADD COLUMN 'VRESION_NO' INTEGER NOT NULL DEFAULT '11';");
// As im sure that table is altered because when i try to alter it again using the same column name,it shows duplicate column name sqlite exception.
For getting all columns count:
daoSession.getMyTableDao().getAllColumns().length // returns old table count
How can get the refreshed table details in GreenDAO?. Is there anyone come across this situation.
Thanks in advance.
Probably you forgot to recreate your dao code from an updated schema.
Greendao doesn't use reflection or scan the database for creating a mapping between database and java. This mapping is created by the dao-generator. So there are two tasks if you want to update your database schema: