diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index aabf6f25a..3fd34d5ca 100644 --- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -187,9 +187,13 @@ public class DatabaseBackend extends SQLiteOpenHelper { return instance; } + @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," @@ -848,13 +852,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()};