12 lines
454 B
MySQL
Raw Normal View History

2019-10-08 02:36:30 +02:00
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,
2019-10-22 19:06:21 +02:00
schedule jsonb NOT NULL DEFAULT '{}',
2019-10-08 02:36:30 +02:00
created_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
2019-10-22 19:06:21 +02:00
updated_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP
2019-10-08 02:36:30 +02:00
);
CREATE TRIGGER set_tasks_updated BEFORE UPDATE ON tasks FOR EACH ROW EXECUTE PROCEDURE set_updated_timestamp();