test trigger for created date

To use for each date
This commit is contained in:
2018-07-04 00:06:43 +02:00
parent 20d2b3dca2
commit 4d3e387989

View File

@@ -38,6 +38,7 @@ CREATE TABLE note (
);
CREATE TABLE action (
id integer primary key,
project_id integer, -- Project id (always set).
task_id integer, -- Task id (set for task or note related actions).
note_id integer, -- Note id (set for note related actions only).
@@ -46,9 +47,7 @@ CREATE TABLE action (
created_at date -- When log message was added?
);
-- TO STUDY
-- CREATE TRIGGER update_created_date BEFORE update ON note
-- begin
-- update note set created_at = strftime('%Y-%m-%d %H:%M:%S:%s', 'now', 'localtime') where action_id = old.action_id
--end
CREATE TRIGGER action_insert_created_at AFTER INSERT ON action
BEGIN
UPDATE action SET created_at = strftime('%Y-%m-%d %H:%M:%S.%s', 'now', 'localtime') WHERE id = new.id;
END