diff options
author | Andreas Straub <andy@strb.org> | 2015-07-20 13:15:49 +0200 |
---|---|---|
committer | Andreas Straub <andy@strb.org> | 2015-07-20 13:15:49 +0200 |
commit | dd964077b97f4d8ca68cf4863a12e3eab0ce7771 (patch) | |
tree | c3160f2ccb0c98436dec46244fe5e26a4b3f78db /src/main/java/eu/siacs/conversations/persistance | |
parent | 2240066bbe697ae4d32a40811a246132898a35ef (diff) |
Fix axolotl database migration
Can't call getWritableDatabase in recreateAxolotlDb()
Diffstat (limited to 'src/main/java/eu/siacs/conversations/persistance')
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index a2c62a8c5..8168b1a6a 100644 --- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -289,7 +289,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { cursor.close(); } if (oldVersion < 15 && newVersion >= 15) { - recreateAxolotlDb(); + recreateAxolotlDb(db); db.execSQL("ALTER TABLE " + Message.TABLENAME + " ADD COLUMN " + Message.FINGERPRINT + " TEXT"); } @@ -910,8 +910,11 @@ public class DatabaseBackend extends SQLiteOpenHelper { } public void recreateAxolotlDb() { + recreateAxolotlDb(getWritableDatabase()); + } + + public void recreateAxolotlDb(SQLiteDatabase db) { Log.d(Config.LOGTAG, AxolotlService.LOGPREFIX+" : "+">>> (RE)CREATING AXOLOTL DATABASE <<<"); - SQLiteDatabase db = this.getWritableDatabase(); db.execSQL("DROP TABLE IF EXISTS " + AxolotlService.SQLiteAxolotlStore.SESSION_TABLENAME); db.execSQL(CREATE_SESSIONS_STATEMENT); db.execSQL("DROP TABLE IF EXISTS " + AxolotlService.SQLiteAxolotlStore.PREKEY_TABLENAME); |