2023-09-14 03:32:55 -05:00
|
|
|
/* init_order = 2 */
|
|
|
|
|
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,
|
2022-04-21 00:31:29 -05:00
|
|
|
id varchar(21) not null,
|
2022-12-20 00:47:12 -05:00
|
|
|
key varchar(128) not null,
|
2023-01-10 00:57:24 -05:00
|
|
|
payload jsonb /* @use LogContextPayload */ not null default '{}'::jsonb,
|
2022-04-21 00:31:29 -05:00
|
|
|
created_at timestamptz not null default (now()),
|
2022-04-18 02:44:36 -05:00
|
|
|
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'));
|
2023-05-22 06:01:54 -05:00
|
|
|
|
|
|
|
create index logs__hook_id
|
|
|
|
on logs (tenant_id, (payload->>'hookId'));
|