Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
686b697d6a
commit
6faff88438
@@ -0,0 +1,18 @@
|
||||
-- Delete the 7,953 placeholder clients created by the bad invoice import.
|
||||
-- These are archived, have numeric external_id (e.g. "10008057"), and have
|
||||
-- no linked cases, invoices, homeowners, contacts, or field values.
|
||||
DELETE FROM public.client_field_values
|
||||
WHERE client_id IN (
|
||||
SELECT id FROM public.clients
|
||||
WHERE archived_at IS NOT NULL AND external_id ~ '^[0-9]+$'
|
||||
);
|
||||
|
||||
DELETE FROM public.client_contacts
|
||||
WHERE client_id IN (
|
||||
SELECT id FROM public.clients
|
||||
WHERE archived_at IS NOT NULL AND external_id ~ '^[0-9]+$'
|
||||
);
|
||||
|
||||
DELETE FROM public.clients
|
||||
WHERE archived_at IS NOT NULL
|
||||
AND external_id ~ '^[0-9]+$';
|
||||
Reference in New Issue
Block a user