diff options
author | Joris | 2020-05-31 17:39:28 +0200 |
---|---|---|
committer | Joris | 2020-05-31 17:39:28 +0200 |
commit | 1bed85a9b107d1b03e71b848829cb7b1f33060f4 (patch) | |
tree | 7e9bc7dd0813b9426e293dde7913717746a479f8 /src/db/init.py | |
parent | a585e507cbe2c05cc846013cafe433953e514295 (diff) |
Prevent removing a tag being used
Diffstat (limited to 'src/db/init.py')
-rw-r--r-- | src/db/init.py | 8 |
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 |