Merge branch 'little-db-fixes' into 'master'

Little db fixes

See merge request fdroid/fdroidclient!729
This commit is contained in:
Hans-Christoph Steiner 2018-08-08 07:28:30 +00:00
commit 10e275037b

View File

@ -228,6 +228,9 @@ public class DBHelper extends SQLiteOpenHelper {
* Only used for testing. Not quite sure how to mock a singleton variable like this. * Only used for testing. Not quite sure how to mock a singleton variable like this.
*/ */
public static void clearDbHelperSingleton() { public static void clearDbHelperSingleton() {
if (instance != null) {
instance.close();
}
instance = null; instance = null;
} }
@ -275,6 +278,12 @@ public class DBHelper extends SQLiteOpenHelper {
} }
} }
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
super.onDowngrade(db, oldVersion, newVersion);
resetTransient(context);
}
@Override @Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {