compareware/Application/Migration/1681641158.sql

12 lines
414 B
MySQL
Raw Normal View History

2024-04-11 18:25:09 +02:00
CREATE TABLE items (
2023-04-16 12:32:51 +02:00
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,
2024-04-11 18:25:09 +02:00
item_id UUID NOT NULL
2023-04-16 12:32:51 +02:00
);
2024-04-11 18:25:09 +02:00
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;