aboutsummaryrefslogtreecommitdiff
path: root/src/db/init.py
diff options
context:
space:
mode:
authorJoris2020-05-31 13:59:35 +0200
committerJoris2020-05-31 13:59:35 +0200
commit0f1610333324d58acafee8c0fa9d9c9bc293b219 (patch)
tree302c37dd3751e9fe2e50ab656d56253bfd2d55fc /src/db/init.py
parent8a6e10d401eea8db0947f8c4b309b8a6256f9748 (diff)
downloadtodo-0f1610333324d58acafee8c0fa9d9c9bc293b219.tar.gz
todo-0f1610333324d58acafee8c0fa9d9c9bc293b219.tar.bz2
todo-0f1610333324d58acafee8c0fa9d9c9bc293b219.zip
Use defined tags for tasks
Diffstat (limited to 'src/db/init.py')
-rw-r--r--src/db/init.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/db/init.py b/src/db/init.py
index 8292dfc..6b4cbea 100644
--- a/src/db/init.py
+++ b/src/db/init.py
@@ -19,7 +19,6 @@ def init(path):
" updated_at INTEGER NOT NULL,"
" name TEXT NOT NULL,"
" duration INTEGER,"
- " tag TEXT,"
" difficulty INT,"
" priority INT,"
" description TEXT"
@@ -34,6 +33,16 @@ def init(path):
" color TEXT NOT NULL"
" )")
+ cursor.execute(
+ " CREATE TABLE IF NOT EXISTS task_tags("
+ " task_id INTEGER NOT NULL,"
+ " tag_id INTEGER NOT NULL,"
+ " created_at INTEGER NOT NULL,"
+ " FOREIGN KEY (task_id) REFERENCES tasks(id),"
+ " FOREIGN KEY (tag_id) REFERENCES tags(id),"
+ " PRIMARY KEY (task_id, tag_id)"
+ " )")
+
database.commit()
return database