compareware/Application/Migration/1681641158.sql

12 lines
414 B
SQL

CREATE TABLE items (
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,
item_id UUID NOT NULL
);
CREATE INDEX tags_item_id_index ON tags (item_id);
ALTER TABLE tags ADD CONSTRAINT tags_ref_item_id FOREIGN KEY (item_id) REFERENCES items (id) ON DELETE NO ACTION;