This commit is contained in:
lbenedar
2026-03-20 18:37:49 +03:00
parent 928870be1c
commit e2434f6b2d
2 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
DROP TABLE IF EXISTS users_permissions;
DROP TABLE IF EXISTS permissions;

View File

@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS permissions (
id bigserial PRIMARY KEY,
code text NOT NULL
);
CREATE TABLE IF NOT EXISTS users_permissions (
user_id bigint NOT NULL REFERENCES users ON DELETE CASCADE,
permission_id bigint NOT NULL REFERENCES permissions ON DELETE CASCADE,
PRIMARY KEY (user_id, permission_id)
);
INSERT INTO permissions (code)
VALUES
('movies:read'),
('movies:write');