diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java index c5d6b398b..c8ecf2f6b 100644 --- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java @@ -185,8 +185,12 @@ public class DatabaseBackend extends SQLiteOpenHelper { } @Override + public void onConfigure(SQLiteDatabase db) { + db.execSQL("PRAGMA foreign_keys=ON"); + } + + @Override public void onCreate(SQLiteDatabase db) { - db.execSQL("PRAGMA foreign_keys=ON;"); db.execSQL("create table " + Account.TABLENAME + "(" + Account.UUID + " TEXT PRIMARY KEY," + Account.USERNAME + " TEXT," + Account.SERVER + " TEXT," @@ -861,13 +865,6 @@ public class DatabaseBackend extends SQLiteOpenHelper { return rows == 1; } - @Override - public SQLiteDatabase getWritableDatabase() { - SQLiteDatabase db = super.getWritableDatabase(); - db.execSQL("PRAGMA foreign_keys=ON;"); - return db; - } - public boolean updateMessage(Message message, boolean includeBody) { SQLiteDatabase db = this.getWritableDatabase(); String[] args = {message.getUuid()}; |