Files
crank/crates/crank-registry/src/migrations/request_trace_identity_v3.sql
T

21 lines
630 B
SQL

alter table invocation_logs
add column trace_id text;
alter table invocation_logs
add constraint invocation_logs_trace_id_format_check
check (
trace_id is null
or (
trace_id ~ '^[0-9a-f]{32}$'
and trace_id <> '00000000000000000000000000000000'
)
) not valid;
create index invocation_logs_workspace_request_id_idx
on invocation_logs(workspace_id, request_id)
where request_id is not null and octet_length(request_id) <= 128;
create index invocation_logs_workspace_trace_id_idx
on invocation_logs(workspace_id, trace_id)
where trace_id is not null;