Skip to content

Commit 89d26cc

Browse files
user_id foreign key on organisation_members table
1 parent 2a62f78 commit 89d26cc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

backend/migrations/20240406024211_create_organisations.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ CREATE TABLE organisation_members (
1919
FOREIGN KEY(organisation_id)
2020
REFERENCES organisations(id)
2121
ON DELETE CASCADE
22-
ON UPDATE CASCADE
22+
ON UPDATE CASCADE,
23+
CONSTRAINT FK_organisation_members_user
24+
FOREIGN KEY(user_id)
25+
REFERENCES users(id)
26+
ON DELETE CASCADE
27+
ON UPDATE CASCADE,
28+
UNIQUE(organisation_id, user_id)
2329
);
2430

2531

0 commit comments

Comments
 (0)