mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
chore: update schema
This commit is contained in:
parent
c2d63a21ac
commit
9bed048d57
2 changed files with 8 additions and 8 deletions
|
@ -13,18 +13,18 @@ const alteration: AlterationScript = {
|
||||||
references tenants (id) on update cascade on delete cascade,
|
references tenants (id) on update cascade on delete cascade,
|
||||||
application_id varchar(21) not null
|
application_id varchar(21) not null
|
||||||
references applications (id) on update cascade on delete cascade,
|
references applications (id) on update cascade on delete cascade,
|
||||||
private_key text not null,
|
private_key varchar not null,
|
||||||
certificate text not null,
|
certificate varchar not null,
|
||||||
created_at timestamptz not null default now(),
|
created_at timestamptz not null default now(),
|
||||||
expires_at timestamptz not null,
|
expires_at timestamptz not null,
|
||||||
active boolean not null,
|
active boolean not null,
|
||||||
primary key (id),
|
primary key (tenant_id, application_id, id),
|
||||||
constraint application_type
|
constraint application_type
|
||||||
check (check_application_type(application_id, 'SAML'))
|
check (check_application_type(application_id, 'SAML'))
|
||||||
);
|
);
|
||||||
|
|
||||||
create unique index saml_application_secrets__unique_active_secret
|
create unique index saml_application_secrets__unique_active_secret
|
||||||
on saml_application_secrets (application_id, active)
|
on saml_application_secrets (tenant_id, application_id, active)
|
||||||
where active;
|
where active;
|
||||||
`);
|
`);
|
||||||
await applyTableRls(pool, 'saml_application_secrets');
|
await applyTableRls(pool, 'saml_application_secrets');
|
||||||
|
|
|
@ -6,17 +6,17 @@ create table saml_application_secrets (
|
||||||
references tenants (id) on update cascade on delete cascade,
|
references tenants (id) on update cascade on delete cascade,
|
||||||
application_id varchar(21) not null
|
application_id varchar(21) not null
|
||||||
references applications (id) on update cascade on delete cascade,
|
references applications (id) on update cascade on delete cascade,
|
||||||
private_key text not null,
|
private_key varchar not null,
|
||||||
certificate text not null,
|
certificate varchar not null,
|
||||||
created_at timestamptz not null default now(),
|
created_at timestamptz not null default now(),
|
||||||
expires_at timestamptz not null,
|
expires_at timestamptz not null,
|
||||||
active boolean not null,
|
active boolean not null,
|
||||||
primary key (id),
|
primary key (tenant_id, application_id, id),
|
||||||
constraint application_type
|
constraint application_type
|
||||||
check (check_application_type(application_id, 'SAML'))
|
check (check_application_type(application_id, 'SAML'))
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Only one active secret per application
|
-- Only one active secret per application
|
||||||
create unique index saml_application_secrets__unique_active_secret
|
create unique index saml_application_secrets__unique_active_secret
|
||||||
on saml_application_secrets (application_id, active)
|
on saml_application_secrets (tenant_id, application_id, active)
|
||||||
where active;
|
where active;
|
||||||
|
|
Loading…
Reference in a new issue