-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'CHAOS-224-KHAOS-rewrite' into CHAOS-461-usercrud
- Loading branch information
Showing
33 changed files
with
2,206 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 10 additions & 7 deletions
17
backend/migrations/20240406024211_create_organisations.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
CREATE TABLE organisations ( | ||
id BIGINT PRIMARY KEY, | ||
name TEXT NOT NULL UNIQUE, | ||
logo TEXT, | ||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP | ||
logo UUID, | ||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL, | ||
updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL | ||
); | ||
|
||
CREATE TABLE organisation_admins ( | ||
id SERIAL PRIMARY KEY, | ||
CREATE TYPE organisation_role AS ENUM ('User', 'Admin'); | ||
|
||
CREATE TABLE organisation_members ( | ||
id BIGSERIAL PRIMARY KEY, | ||
organisation_id BIGINT NOT NULL, | ||
user_id BIGINT NOT NULL, | ||
CONSTRAINT FK_organisation_admins_organisation | ||
role organisation_role DEFAULT 'User' NOT NULL, | ||
CONSTRAINT FK_organisation_members_organisation | ||
FOREIGN KEY(organisation_id) | ||
REFERENCES organisations(id) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE | ||
); | ||
|
||
CREATE INDEX IDX_organisation_admins_organisation on organisation_admins (organisation_id); | ||
CREATE INDEX IDX_organisation_admins_organisation on organisation_members (organisation_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.