Added Location and location ownership/rights to gamenight.

This commit is contained in:
2025-12-24 14:48:54 +01:00
parent 8a48119c80
commit ff88029a4b
57 changed files with 3034 additions and 995 deletions

View File

@@ -0,0 +1,18 @@
CREATE TABLE location (
id UUID NOT NULL PRIMARY KEY,
name VARCHAR UNIQUE NOT NULL,
address VARCHAR,
note VARCHAR
);
CREATE TABLE location_owner (
location_id UUID NOT NULL,
user_id UUID NOT NULL,
CONSTRAINT FK_location_id FOREIGN KEY (location_id) REFERENCES location(id) ON DELETE CASCADE,
CONSTRAINT FK_user_id FOREIGN KEY (user_id) REFERENCES client(id) ON DELETE CASCADE,
PRIMARY KEY(location_id, user_id)
);
ALTER TABLE gamenight
ADD location_id UUID,
ADD CONSTRAINT FK_location_id FOREIGN KEY (location_id) REFERENCES location(id) ON DELETE SET NULL;