Created
August 10, 2024 10:42
-
-
Save ratul0/f177744fa3517a76ac9a591744bbfc89 to your computer and use it in GitHub Desktop.
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
CREATE TABLE users ( id SERIAL PRIMARY KEY, cognito_id VARCHAR(255) UNIQUE NOT NULL ); | |
CREATE TABLE applications ( id SERIAL PRIMARY KEY, app_id VARCHAR(50) UNIQUE NOT NULL, name VARCHAR(100) NOT NULL ); | |
CREATE TABLE roles ( id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, application_id INTEGER REFERENCES applications(id) ); | |
CREATE TABLE permissions ( id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, application_id INTEGER REFERENCES applications(id) ); | |
CREATE TABLE user_roles ( user_id INTEGER REFERENCES users(id), role_id INTEGER REFERENCES roles(id), PRIMARY KEY (user_id, role_id) ); | |
CREATE TABLE role_permissions ( role_id INTEGER REFERENCES roles(id), permission_id INTEGER REFERENCES permissions(id), PRIMARY KEY (role_id, permission_id) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment