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/oidc_model_instances.sql

35 lines
903 B
MySQL
Raw Normal View History

2021-06-22 11:07:51 -05:00
create table oidc_model_instances (
2023-01-19 07:27:01 -05:00
tenant_id varchar(21) not null
references tenants (id) on update cascade on delete cascade,
2021-06-22 11:07:51 -05:00
model_name varchar(64) not null,
id varchar(128) not null,
payload jsonb /* @use OidcModelInstancePayload */ not null,
2021-08-18 03:36:52 -05:00
expires_at timestamptz not null,
consumed_at timestamptz,
2023-01-19 07:27:01 -05:00
primary key (id)
2021-06-22 11:07:51 -05:00
);
2023-01-19 07:27:01 -05:00
create index oidc_model_instances__model_name_id
on oidc_model_instances (tenant_id, model_name, id);
create index oidc_model_instances__model_name_payload_user_code
2023-01-19 07:27:01 -05:00
on oidc_model_instances (
tenant_id,
model_name,
(payload->>'userCode')
);
2021-06-22 11:07:51 -05:00
create index oidc_model_instances__model_name_payload_uid
2023-01-19 07:27:01 -05:00
on oidc_model_instances (
tenant_id,
model_name,
(payload->>'uid')
);
2021-06-22 11:07:51 -05:00
create index oidc_model_instances__model_name_payload_grant_id
2023-01-19 07:27:01 -05:00
on oidc_model_instances (
tenant_id,
model_name,
(payload->>'grantId')
);