Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GreenDAO onUpdate

When I update the database version it's not dropping all the tables (thought I'll be the default behaviour). Do I have to do anything else?

like image 242
Javier Manzano Avatar asked Dec 06 '25 02:12

Javier Manzano


2 Answers

Which SQLiteOpenHelper are you using?

Check your generated DaoMaster class. It has an inner class DevOpenHelper which drops all tables on update.

like image 177
Markus Junginger Avatar answered Dec 08 '25 16:12

Markus Junginger


Please check DaoMaster.java

@Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            dropAllTables(db, true);
            onCreate(db);
        }

Make Sure dropAllTables(db, true); have true and again problem exist debug here

like image 29
kukku Avatar answered Dec 08 '25 15:12

kukku



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!