forked from wangziqi/gongxue-base
feat: add crm webhook worker
This commit is contained in:
16
supabase/migrations/202606290010_crm_worker_hardening.sql
Normal file
16
supabase/migrations/202606290010_crm_worker_hardening.sql
Normal 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);
|
||||
Reference in New Issue
Block a user