mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
de37e71239
add new application user consent organizations table
16 lines
875 B
SQL
16 lines
875 B
SQL
/* init_order = 3 */
|
|
|
|
/** The relations between applications, users and organizations. A relation means that a user has consented to an application to access data in an organization. */
|
|
create table application_user_consent_organizations (
|
|
tenant_id varchar(21) not null
|
|
references tenants (id) on update cascade on delete cascade,
|
|
application_id varchar(21) not null
|
|
references applications (id) on update cascade on delete cascade,
|
|
organization_id varchar(21) not null,
|
|
user_id varchar(21) not null,
|
|
primary key (tenant_id, application_id, organization_id, user_id),
|
|
/** User's consent to an application should be synchronized with the user's membership in the organization. */
|
|
foreign key (tenant_id, organization_id, user_id)
|
|
references organization_user_relations (tenant_id, organization_id, user_id)
|
|
on update cascade on delete cascade
|
|
)
|