Added Location and location ownership/rights to gamenight.
This commit is contained in:
@@ -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