aboutsummaryrefslogtreecommitdiff
path: root/src/db/init.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/init.py')
-rw-r--r--src/db/init.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/db/init.py b/src/db/init.py
index 6b4cbea..77920cf 100644
--- a/src/db/init.py
+++ b/src/db/init.py
@@ -8,9 +8,9 @@ def init(path):
database = sqlite3.connect(path)
- if is_db_new:
+ cursor = database.cursor()
- cursor = database.cursor()
+ if is_db_new:
cursor.execute(
" CREATE TABLE IF NOT EXISTS tasks("
@@ -43,6 +43,8 @@ def init(path):
" PRIMARY KEY (task_id, tag_id)"
" )")
- database.commit()
+ cursor.execute("PRAGMA foreign_keys = ON")
+
+ database.commit()
return database