Files
Jyotisha/frontend/supabase/migrations/20260807010000_retire_legacy_rectification_runtime.sql
T
Jesse_Chen f3946eaa6f
Staging Backend Quality Gate / validate (push) Failing after 9m57s
Staging Backend Quality Gate / publish (push) Has been skipped
chore: retire legacy rectification runtime
2026-08-07 12:55:32 +08:00

40 lines
1.1 KiB
PL/PgSQL

begin;
update public.birth_time_rectification_question_handoffs
set state = 'consumed',
claim_action_id = null,
lease_expires_at = null,
consumed_at = coalesce(consumed_at, pg_catalog.now()),
updated_at = pg_catalog.now()
where state <> 'consumed';
update public.birth_time_rectification_v4_handoffs
set state = 'consumed',
claim_action_id = null,
lease_expires_at = null,
consumed_at = coalesce(consumed_at, pg_catalog.now()),
updated_at = pg_catalog.now()
where state <> 'consumed';
update public.birth_time_rectification_v4_jobs
set status = 'stale',
worker_id = null,
lease_expires_at = null,
updated_at = pg_catalog.now()
where status in ('pending', 'processing');
update public.birth_time_rectification_v4_cases
set status = 'abandoned',
current_question = null,
updated_at = pg_catalog.now()
where status <> 'abandoned'
and accepted_range_start is null;
update public.birth_time_rectification_cases
set status = 'abandoned',
pending_consultation_question = null,
updated_at = pg_catalog.now()
where status not in ('confirmed', 'completed', 'abandoned');
commit;