forked from Roflin/gamenight
Added Location and location ownership/rights to gamenight.
This commit is contained in:
1 parent
8a48119c80
commit
ff88029a4b
57 files changed
+3034
-995
No files matched your search
@@ -0,0 +1,8 @@
|
||||
|
||||
ALTER TABLE gamenight
|
||||
DROP CONSTRAINT FK_location_id,
|
||||
DROP column location_id;
|
||||
|
||||
DROP TABLE location_owner;
|
||||
|
||||
DROP TABLE location;
|
||||
@@ -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;
|
||||
Reference in new issue
Block a user