Files
ai-exchange/migrations/043_create_runtime_incidents.sql
T
2026-05-12 08:54:45 +08:00

22 lines
772 B
SQL

create table if not exists runtime_incidents (
id bigserial primary key,
incident_key text not null unique,
severity text not null,
source text not null,
reason text not null,
subject text not null default 'runtime',
status text not null default 'open',
first_seen_ts timestamptz not null,
last_seen_ts timestamptz not null,
occurrence_count integer not null default 1,
recommended_action text not null default '',
last_error text,
payload jsonb not null default '{}'::jsonb
);
create index if not exists idx_runtime_incidents_last_seen_desc
on runtime_incidents (last_seen_ts desc, id desc);
create index if not exists idx_runtime_incidents_severity_status
on runtime_incidents (severity, status, last_seen_ts desc);