]> git.ktnx.net Git - mobile-ledger.git/commitdiff
turn foreign_keys PRAGMA in Room too
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 2 Feb 2021 20:22:21 +0000 (22:22 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Tue, 2 Feb 2021 20:22:21 +0000 (22:22 +0200)
app/src/main/java/net/ktnx/mobileledger/db/DB.java

index f65f503fccfc49583690d1a864c4a28575e7ce59..9a73f4d45601bae8be56287325d474637e917ff0 100644 (file)
@@ -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();
         }
     }