Files
acmcc/supabase/migrations/20260426015024_e7cc0940-9f56-4d62-b40f-0416bb59fd2f.sql
2026-06-01 20:19:26 -04:00

21 lines
727 B
SQL

-- Erase legacy QBO sync data so it doesn't conflict with the active Zoho integration
-- Clear QBO references on company bank transactions
UPDATE public.company_bank_transactions
SET qbo_id = NULL,
qbo_sync_status = NULL
WHERE qbo_id IS NOT NULL OR qbo_sync_status IS NOT NULL;
-- Clear QBO references on client invoices (no rows currently, but reset for safety)
UPDATE public.client_invoices
SET qbo_invoice_id = NULL,
qbo_sync_status = 'not_synced',
qbo_synced_at = NULL,
qbo_sync_error = NULL
WHERE qbo_invoice_id IS NOT NULL
OR qbo_sync_status NOT IN ('not_synced')
OR qbo_synced_at IS NOT NULL
OR qbo_sync_error IS NOT NULL;
-- Wipe the QBO sync log entirely
TRUNCATE TABLE public.qbo_sync_log;