Files
ai-exchange/migrations/034_create_alert_deliveries.sql
2026-05-11 23:37:47 +08:00

15 lines
503 B
SQL

create table if not exists alert_deliveries (
id bigserial primary key,
alert_id bigint not null references decision_alerts(id) on delete cascade,
channel text not null,
status text not null,
attempted_ts timestamptz not null,
delivered_ts timestamptz,
external_message_id text,
error text,
payload jsonb not null default '{}'::jsonb
);
create index if not exists idx_alert_deliveries_alert_attempted_desc
on alert_deliveries (alert_id, attempted_ts desc, id desc);