mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-28 08:05:45 +00:00
feat: refuse to downgrade past the campaign send tracking migration once any send has recorded its tracking, instead of dropping what the rates read
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
-- Refuse rather than discard which sends carried tracking; the rates read it and nothing can rebuild it.
|
||||
DO $$
|
||||
DECLARE
|
||||
recorded boolean;
|
||||
BEGIN
|
||||
IF EXISTS (SELECT 1 FROM information_schema.columns
|
||||
WHERE table_schema = current_schema() AND table_name = 'campaign_contact_progress' AND column_name = 'open_tracked') THEN
|
||||
EXECUTE 'SELECT EXISTS (SELECT 1 FROM campaign_contact_progress WHERE open_tracked IS NOT NULL OR click_tracked IS NOT NULL)' INTO recorded;
|
||||
IF recorded THEN
|
||||
RAISE EXCEPTION 'campaign sends recorded their tracking after 000395; roll forward instead of downgrading past it';
|
||||
END IF;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
ALTER TABLE campaign_contact_progress
|
||||
DROP COLUMN IF EXISTS open_tracked,
|
||||
DROP COLUMN IF EXISTS click_tracked;
|
||||
|
||||
Reference in New Issue
Block a user