mirror of
https://github.com/logto-io/logto.git
synced 2025-03-10 22:22:45 -05:00
chore: update schema
This commit is contained in:
parent
96ae79c37c
commit
fc5d575dd2
3 changed files with 4 additions and 15 deletions
|
@ -11,7 +11,7 @@ const alteration: AlterationScript = {
|
|||
tenant_id varchar(21) not null
|
||||
references tenants (id) on update cascade on delete cascade,
|
||||
id varchar(21) not null,
|
||||
email varchar(256) not null,
|
||||
email varchar(128) not null,
|
||||
token varchar(256) not null,
|
||||
context jsonb not null default '{}'::jsonb,
|
||||
status varchar(64) not null default 'active',
|
||||
|
@ -20,11 +20,7 @@ const alteration: AlterationScript = {
|
|||
primary key (id)
|
||||
);
|
||||
|
||||
create index one_time_token__id on one_time_tokens (tenant_id, id);
|
||||
|
||||
create index one_time_token__email on one_time_tokens (tenant_id, email);
|
||||
|
||||
create unique index one_time_token__active_unique on one_time_tokens (tenant_id, email, token) where status = 'active';
|
||||
create index one_time_token__email_status on one_time_tokens (tenant_id, email, status);
|
||||
`);
|
||||
|
||||
await applyTableRls(pool, 'one_time_tokens');
|
||||
|
|
|
@ -2,15 +2,12 @@ import { type ToZodObject } from '@logto/connector-kit';
|
|||
import { z } from 'zod';
|
||||
|
||||
export type OneTimeTokenContext = {
|
||||
// Declare the appIds that users can sign-up to.
|
||||
applicationIds?: string[];
|
||||
// Used for organization JIT provisioning.
|
||||
jitOrganizationIds?: string[];
|
||||
};
|
||||
|
||||
export const oneTimeTokenContextGuard = z
|
||||
.object({
|
||||
applicationIds: z.string().array(),
|
||||
jitOrganizationIds: z.string().array(),
|
||||
})
|
||||
.partial() satisfies ToZodObject<OneTimeTokenContext>;
|
||||
|
|
|
@ -4,7 +4,7 @@ create table one_time_tokens (
|
|||
tenant_id varchar(21) not null
|
||||
references tenants (id) on update cascade on delete cascade,
|
||||
id varchar(21) not null,
|
||||
email varchar(256) not null,
|
||||
email varchar(128) not null,
|
||||
token varchar(256) not null,
|
||||
context jsonb /* @use OneTimeTokenContext */ not null default '{}'::jsonb,
|
||||
status varchar(64) /* @use OneTimeTokenStatus */ not null default 'active',
|
||||
|
@ -13,8 +13,4 @@ create table one_time_tokens (
|
|||
primary key (id)
|
||||
);
|
||||
|
||||
create index one_time_token__id on one_time_tokens (tenant_id, id);
|
||||
|
||||
create index one_time_token__email on one_time_tokens (tenant_id, email);
|
||||
|
||||
create unique index one_time_token__active_unique on one_time_tokens (tenant_id, email, token) where status = 'active';
|
||||
create index one_time_token__email_status on one_time_tokens (tenant_id, email, status);
|
||||
|
|
Loading…
Add table
Reference in a new issue