Skip to content

Commit

Permalink
Mark DB current after backup upgrade process
Browse files Browse the repository at this point in the history
  • Loading branch information
moxie0 committed Apr 2, 2018
1 parent c0da061 commit 2c82b36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public static SQLiteDatabase getBackupDatabase(Context context) {

public static void upgradeRestored(Context context, SQLiteDatabase database){
getInstance(context).databaseHelper.onUpgrade(database, database.getVersion(), -1);
getInstance(context).databaseHelper.markCurrent(database);
}

private DatabaseFactory(@NonNull Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ public SQLiteDatabase getWritableDatabase() {
return getWritableDatabase(databaseSecret.asString());
}

public void markCurrent(SQLiteDatabase db) {
db.setVersion(DATABASE_VERSION);
}

private void executeStatements(SQLiteDatabase db, String[] statements) {
for (String statement : statements)
db.execSQL(statement);
Expand Down

0 comments on commit 2c82b36

Please sign in to comment.