From 0d9563b422ebc47fb57753e812c68bbbb1d4a8f2 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Tue, 2 Feb 2021 22:22:21 +0200 Subject: [PATCH] turn foreign_keys PRAGMA in Room too --- app/src/main/java/net/ktnx/mobileledger/db/DB.java | 7 +++++++ 1 file changed, 7 insertions(+) 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(); } } -- 2.39.5