From 3aee0f611c41b96d2f4877da11961846b5ff6a15 Mon Sep 17 00:00:00 2001 From: Tau Date: Sun, 27 Oct 2019 09:34:31 -0400 Subject: [PATCH] sql/sqlite.ts: Make FK constraints do something They don't by default, because they didn't in older versions of SQLite and some older applications might rely on that. You have to send an explicit pragma prior to opening a transaction to make them take effect. --- src/sql/sqlite.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sql/sqlite.ts b/src/sql/sqlite.ts index cb4cb71..d19b78b 100644 --- a/src/sql/sqlite.ts +++ b/src/sql/sqlite.ts @@ -92,6 +92,7 @@ class SqliteDataSource implements DataSource { const db = new Database(this._path); db.defaultSafeIntegers(); + db.prepare("pragma foreign_keys = on").run(); db.prepare("begin").run(); try {