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,
|
2021-07-04 08:17:55 -05:00
|
|
|
payload jsonb /* @use OidcModelInstancePayload */ not null,
|
2021-08-18 03:36:52 -05:00
|
|
|
expires_at timestamptz not null,
|
|
|
|
consumed_at timestamptz,
|
2023-01-28 06:26:29 -05:00
|
|
|
primary key (id),
|
|
|
|
constraint oidc_model_instances__model_name_id
|
|
|
|
unique (tenant_id, model_name, id)
|
2021-06-22 11:07:51 -05:00
|
|
|
);
|
|
|
|
|
2021-07-04 08:17:55 -05:00
|
|
|
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
|
|
|
|
2021-07-04 08:17:55 -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
|
|
|
|
2021-07-04 08:17:55 -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')
|
|
|
|
);
|