Tasks query API, yay!

This commit is contained in:
2019-10-08 02:36:30 +02:00
parent e9e4d8b51d
commit c996881547
15 changed files with 170 additions and 11 deletions

View File

@@ -0,0 +1,14 @@
CREATE TABLE tasks (
id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
owner integer NOT NULL REFERENCES users(id),
name text NOT NULL,
notes text,
schedule task_schedule NOT NULL DEFAULT 'daily',
min_frequency integer,
max_frequency integer,
created_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
CHECK(min_frequency IS NULL OR max_frequency IS NULL OR max_frequency > min_frequency)
);
CREATE TRIGGER set_tasks_updated BEFORE UPDATE ON tasks FOR EACH ROW EXECUTE PROCEDURE set_updated_timestamp();