In my Android application I'm using the SQLite DB with SQLiteOpenHelper
I have several DB versions, and I've been doing onUpgrade()
operations by switching on the old db version, but now I have to remove one of the tables because I'm no longer using it, so should I do something different?
public void onCreate(SQLiteDatabase database) {
database.execSQL(tableUserCreate);
database.execSQL(tableProductsCreate);
database.execSQL(tablePicturesCreate);
}
public void onUpgrade(SQLiteDatabase database, int version_old, int current_version) {
switch (version_old) {
case 1:
database.execSQL(addPostcodeFieldToUserTable);
database.execSQL(tablePlacesCreate);
// Intentional fallthrough, no break;
case 2:
database.execSQL(tableProductVideosCreate);
break;
}
} // End of onUpgrade
Now I want to remove the User table in a new DB version. What do I do?
Aucun commentaire:
Enregistrer un commentaire