From: Damyan Ivanov Date: Tue, 2 Feb 2021 20:22:21 +0000 (+0200) Subject: turn foreign_keys PRAGMA in Room too X-Git-Tag: v0.17.0~169 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=0d9563b422ebc47fb57753e812c68bbbb1d4a8f2;p=mobile-ledger.git turn foreign_keys PRAGMA in Room too --- diff --git a/app/src/main/java/net/ktnx/mobileledger/db/DB.java b/app/src/main/java/net/ktnx/mobileledger/db/DB.java index f65f503f..9a73f4d4 100644 --- a/app/src/main/java/net/ktnx/mobileledger/db/DB.java +++ b/app/src/main/java/net/ktnx/mobileledger/db/DB.java @@ -121,6 +121,13 @@ abstract public class DB extends RoomDatabase { } } }) + .addCallback(new Callback() { + @Override + public void onOpen(@NonNull SupportSQLiteDatabase db) { + super.onOpen(db); + db.execSQL("PRAGMA foreign_keys = ON"); + } + }) .build(); } }