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

27 lines
745 B
MySQL
Raw Normal View History

create table passcodes (
2023-01-19 07:27:01 -05:00
tenant_id varchar(21) not null
references tenants (id) on update cascade on delete cascade,
id varchar(21) not null,
interaction_jti varchar(128),
phone varchar(32),
email varchar(128),
type varchar(32) not null,
code varchar(6) not null,
2023-02-12 05:43:02 -05:00
consumed boolean not null default false,
try_count int2 not null default 0,
created_at timestamptz not null default(now()),
primary key (id)
);
2023-01-19 07:27:01 -05:00
create index passcodes__id
on passcodes (tenant_id, id);
create index passcodes__interaction_jti_type
2023-01-19 07:27:01 -05:00
on passcodes (tenant_id, interaction_jti, type);
create index passcodes__email_type
2023-01-19 07:27:01 -05:00
on passcodes (tenant_id, email, type);
create index passcodes__phone_type
2023-01-19 07:27:01 -05:00
on passcodes (tenant_id, phone, type);