Files
gongxue-base/supabase/migrations/202606290010_crm_worker_hardening.sql
2026-06-29 04:35:19 +08:00

17 lines
635 B
SQL

alter table public.crm_webhook_queue
add column if not exists provider text,
add column if not exists last_attempt_at timestamptz,
add column if not exists last_response_summary text;
do $$
begin
if not exists (select 1 from pg_constraint where conname = 'crm_webhook_queue_status_check') then
alter table public.crm_webhook_queue
add constraint crm_webhook_queue_status_check
check (status in ('pending', 'processing', 'retrying', 'sent', 'failed', 'discarded'));
end if;
end $$;
create index if not exists idx_crm_queue_due
on public.crm_webhook_queue(tenant_id, status, scheduled_at, next_attempt_at);