feat: add crm webhook worker

This commit is contained in:
Codex
2026-06-29 04:35:19 +08:00
parent 0cff0d102d
commit ead1296f80
23 changed files with 1098 additions and 14 deletions

View File

@@ -0,0 +1,16 @@
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);