lundi 9 mars 2015

Will onUpgrade be called for each increment?

Assume i have my app's database version 1 running on some user device for a while.


in the meantime i increment database version to 2, and then to 3 and handle onUpgrade like that :



if (oldVersion == 1 && newVersion == 2) {
db.execSQL(String.format("ALTER TABLE ... ADD .. text", ));

} else if (oldVersion == 2 && newVersion == 3) {
db.execSQL(String.format("ALTER TABLE ... ADD .. text", ));
}


When that user upgrades my app, will both blocks be executed?


Aucun commentaire:

Enregistrer un commentaire