21 lines
1.2 KiB
SQL
21 lines
1.2 KiB
SQL
-- ============================================================
|
|
-- SuperSam: Автодозвон — очередь ручных звонков (Фаза 3, п.9)
|
|
-- 02.09.2026. Аддитивная. Убирает нехватку autocall_queue из базовой миграции.
|
|
-- Применять: docker exec supabase-db psql -U supabase_admin -d postgres -f <file>
|
|
-- ============================================================
|
|
|
|
create table if not exists public.autocall_queue (
|
|
id bigint generated always as identity primary key,
|
|
order_group_id uuid not null references public.order_groups(id) on delete cascade,
|
|
phone text not null,
|
|
scenario text not null default 'A',
|
|
requested_by uuid,
|
|
requested_at timestamptz not null default now(),
|
|
processed_at timestamptz
|
|
);
|
|
create index if not exists idx_autocall_queue_pending
|
|
on public.autocall_queue(processed_at) where processed_at is null;
|
|
grant select, insert, update on public.autocall_queue to authenticated;
|
|
comment on table public.autocall_queue
|
|
is 'Ручные запросы «Позвонить сейчас». Планировщик забирает processed_at is null и создаёт call-файл (без ssh из edge fn).';
|