Work on count nb task (and nb note)
This commit is contained in:
@@ -14,7 +14,7 @@ CREATE TABLE project (
|
||||
);
|
||||
|
||||
CREATE TABLE task (
|
||||
id integer primary key,
|
||||
id integer primary key, -- TODO When delete, counter go down ==> problem?? Use autoincrement?
|
||||
project_id integer, -- Which project the task belongs to?
|
||||
username text, -- User the task belongs to.
|
||||
name text, -- Task name.
|
||||
@@ -27,6 +27,16 @@ CREATE TABLE task (
|
||||
updated_at date -- When the task was last updated?
|
||||
);
|
||||
|
||||
-- CREATE TRIGGER insert_task AFTER INSERT ON task
|
||||
-- BEGIN
|
||||
-- UPDATE project SET number_of_tasks = (SELECT count(*) FROM task WHERE project_id = new.project_id) WHERE id = new.project_id;
|
||||
-- END;
|
||||
|
||||
-- CREATE TRIGGER delete_task AFTER DELETE ON task
|
||||
-- BEGIN
|
||||
-- UPDATE project SET number_of_tasks = (SELECT count(*) FROM task WHERE project_id = old.project_id) WHERE id = old.project_id;
|
||||
-- END;
|
||||
|
||||
CREATE TABLE note (
|
||||
id integer primary key,
|
||||
project_id integer, -- Project the note belongs to (0 if belongs to task).
|
||||
|
||||
Reference in New Issue
Block a user