Ensure foreign key constraints are always enforced
This commit is contained in:
@@ -20,6 +20,7 @@ def get_db() -> Generator[sqlite3.Connection, None, None]:
|
||||
"""Get a database connection context manager."""
|
||||
conn = sqlite3.connect(settings.database_path)
|
||||
conn.row_factory = sqlite3.Row # Enable dict-like access to rows
|
||||
conn.execute("PRAGMA foreign_keys = ON")
|
||||
try:
|
||||
yield conn
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user