0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-23 20:33:16 -05:00
logto/packages/schemas/tables/organization_role_user_relations.sql
2023-10-07 17:49:28 +08:00

14 lines
704 B
SQL

/* init_order = 2 */
/** The relations between organizations, organization roles, and users. A relation means that a user has a role in an organization. */
create table organization_role_user_relations (
tenant_id varchar(21) not null
references tenants (id) on update cascade on delete cascade,
organization_id varchar(21) not null
references organizations (id) on update cascade on delete cascade,
organization_role_id varchar(21) not null
references organization_roles (id) on update cascade on delete cascade,
user_id varchar(21) not null
references users (id) on update cascade on delete cascade,
primary key (tenant_id, organization_id, organization_role_id, user_id)
);