-- Roll back t-paliad-064 reminder redesign schema. -- -- Drops the partial dedup index, the new columns on paliad.users and -- paliad.reminder_log, and restores the previous reminder_type CHECK -- constraint. Reversible. DROP INDEX IF EXISTS paliad.reminder_log_slot_dedup_idx; ALTER TABLE paliad.reminder_log DROP CONSTRAINT IF EXISTS reminder_log_slot_check; -- Narrow the reminder_type CHECK back to the original three values. Any -- 'morning_digest' / 'evening_digest' rows must be deleted before this -- runs, or the ALTER fails. ALTER TABLE paliad.reminder_log DROP CONSTRAINT IF EXISTS reminder_log_reminder_type_check; ALTER TABLE paliad.reminder_log ADD CONSTRAINT reminder_log_reminder_type_check CHECK (reminder_type IN ('overdue', 'tomorrow', 'weekly')); ALTER TABLE paliad.reminder_log DROP COLUMN IF EXISTS slot, DROP COLUMN IF EXISTS slot_date; ALTER TABLE paliad.users DROP CONSTRAINT IF EXISTS users_escalation_contact_self_check, DROP CONSTRAINT IF EXISTS users_reminder_warning_offset_check; ALTER TABLE paliad.users DROP COLUMN IF EXISTS escalation_contact_id, DROP COLUMN IF EXISTS reminder_warning_offset_days;