Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

Commit

Permalink
db: make sure onUpgrade is triggered before any other code.
Browse files Browse the repository at this point in the history
Makes sure the site legacy function is called.
  • Loading branch information
floens committed Apr 27, 2018
1 parent 5b88745 commit 5d39feb
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.floens.chan.core.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
Expand Down Expand Up @@ -77,6 +78,11 @@ public DatabaseManager(Context context) {
new LinkedBlockingQueue<>());

helper = new DatabaseHelper(context);

// Immediately trigger onUpgrade if necessary.
SQLiteDatabase writableDatabase = helper.getWritableDatabase();
writableDatabase.close();

databaseLoadableManager = new DatabaseLoadableManager(this, helper);
databasePinManager = new DatabasePinManager(this, helper, databaseLoadableManager);
databaseHistoryManager = new DatabaseHistoryManager(this, helper, databaseLoadableManager);
Expand Down

0 comments on commit 5d39feb

Please sign in to comment.