You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the foreign key enforcement in SQLite is disabled by default, would it be possible to add an option that enable it automatically?
$ sqlite3
SQLite version 3.9.2 2015-11-02 18:31:45
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> pragma foreign_keys;
0
Reacted by Christopher Bruton and Jakub Romanowski
Each function which is decorated with @pragmaForeignKeys will run PRAGMA foreign_keys = ON first. Only requirement is that connection to sqlite (db) must be first parameter in doSomethingWithSQL.
Activity
kotoko commentedon Dec 18, 2021
If someone else is interested I came up with following workaround. First create function decorator:
Then instead of this:
you can write this:
Each function which is decorated with
@pragmaForeignKeyswill runPRAGMA foreign_keys = ONfirst. Only requirement is that connection to sqlite (db) must be first parameter indoSomethingWithSQL.