15 lines
557 B
SQL
15 lines
557 B
SQL
CREATE TABLE IF NOT EXISTS role_resource_actions (
|
|
role_id UUID NOT NULL,
|
|
resource_action_id UUID NOT NULL,
|
|
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
|
|
PRIMARY KEY (role_id, resource_action_id),
|
|
CONSTRAINT fk_role_actions_role_id
|
|
FOREIGN KEY(role_id)
|
|
REFERENCES roles(id),
|
|
CONSTRAINT fk_role_actions_resource_action_id
|
|
FOREIGN KEY(resource_action_id)
|
|
REFERENCES resource_actions(id)
|
|
);
|
|
|
|
CREATE INDEX idx_role_resource_actions_role_id ON role_resource_actions (role_id);
|