beteran-server-service/migrations/202206201410_member_permission/up.sql

16 lines
671 B
MySQL
Raw Normal View History

2022-08-06 11:37:51 +00:00
CREATE TABLE IF NOT EXISTS member_permissions (
2022-08-06 11:51:49 +00:00
member_id UUID NOT NULL,
resource_action_id UUID NOT NULL,
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
PRIMARY KEY (member_id, resource_action_id),
2022-08-06 11:37:51 +00:00
CONSTRAINT fk_member_permissions_member_id
FOREIGN KEY(member_id)
REFERENCES members(id),
2022-08-06 11:51:49 +00:00
CONSTRAINT fk_member_permissions_resource_action_id
FOREIGN KEY(resource_action_id)
REFERENCES resource_actions(id)
2022-08-06 11:37:51 +00:00
);
2022-08-06 11:51:49 +00:00
CREATE INDEX idx_member_permissions_resource_action_id ON member_permissions (resource_action_id);
2022-08-06 11:37:51 +00:00
CREATE INDEX idx_member_permissions_member_id ON member_permissions (member_id);