I am using a ContentProvider. My SQLiteOpenHelper class contains the method
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + table1);
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + table2);
onCreate(sqLiteDatabase);
}
Say I am in a situation where I do not remember the name of the tables (I lost them somehow. Play with me). How do I delete all of them from inside the method onUpgrade
? I see mention of
PRAGMA writable_schema = 1;
delete from sqlite_master where type in ('table', 'index', 'trigger');
PRAGMA writable_schema = 0;
But I don't know how to apply it to the onUpgrade
method.