Added tasks and tags data structures

This commit is contained in:
Marc Scholten 2023-04-16 12:32:51 +02:00
parent 183219d6e1
commit 930dfff56e
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,11 @@
CREATE TABLE tasks (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
description TEXT NOT NULL
);
CREATE TABLE tags (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
name TEXT NOT NULL,
task_id UUID NOT NULL
);
CREATE INDEX tags_task_id_index ON tags (task_id);
ALTER TABLE tags ADD CONSTRAINT tags_ref_task_id FOREIGN KEY (task_id) REFERENCES tasks (id) ON DELETE NO ACTION;

View File

@ -1 +1,12 @@
-- Your database schema. Use the Schema Designer at http://localhost:8001/ to add some tables.
CREATE TABLE tasks (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
description TEXT NOT NULL
);
CREATE TABLE tags (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
name TEXT NOT NULL,
task_id UUID NOT NULL
);
CREATE INDEX tags_task_id_index ON tags (task_id);
ALTER TABLE tags ADD CONSTRAINT tags_ref_task_id FOREIGN KEY (task_id) REFERENCES tasks (id) ON DELETE NO ACTION;