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

22 lines
584 B
MySQL
Raw Normal View History

2023-01-19 07:27:01 -05:00
create table logs (
tenant_id varchar(21) not null
references tenants (id) on update cascade on delete cascade,
id varchar(21) not null,
key varchar(128) not null,
payload jsonb /* @use LogContextPayload */ not null default '{}'::jsonb,
created_at timestamptz not null default (now()),
primary key (id)
);
2023-01-19 07:27:01 -05:00
create index logs__id
on logs (tenant_id, id);
create index logs__key
on logs (tenant_id, key);
create index logs__user_id
2023-02-12 05:43:02 -05:00
on logs (tenant_id, (payload->>'userId'));
2023-01-19 07:27:01 -05:00
create index logs__application_id
2023-02-12 05:43:02 -05:00
on logs (tenant_id, (payload->>'applicationId'));