From 930dfff56e17b2d925bbd1faafb40d3e3452e9ac Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 16 Apr 2023 12:32:51 +0200 Subject: [PATCH] Added tasks and tags data structures --- Application/Migration/1681641158.sql | 11 +++++++++++ Application/Schema.sql | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 Application/Migration/1681641158.sql diff --git a/Application/Migration/1681641158.sql b/Application/Migration/1681641158.sql new file mode 100644 index 0000000..0d00bd0 --- /dev/null +++ b/Application/Migration/1681641158.sql @@ -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; diff --git a/Application/Schema.sql b/Application/Schema.sql index b743c66..f8fcad3 100644 --- a/Application/Schema.sql +++ b/Application/Schema.sql @@ -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;