Files
descrybe/apps/api/sql/schema/014_email_unsub_pending.sql
T
greeneclipse 8580c996c3 Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
2026-08-09 22:47:43 +02:00

10 lines
532 B
SQL

-- +goose Up
-- Allow pending unsubscribe tokens (issued at send time) before the recipient opts out.
ALTER TABLE email_unsubscribes ALTER COLUMN unsubscribed_at DROP NOT NULL;
ALTER TABLE email_unsubscribes ALTER COLUMN unsubscribed_at DROP DEFAULT;
-- +goose Down
UPDATE email_unsubscribes SET unsubscribed_at = COALESCE(unsubscribed_at, now()) WHERE unsubscribed_at IS NULL;
ALTER TABLE email_unsubscribes ALTER COLUMN unsubscribed_at SET DEFAULT now();
ALTER TABLE email_unsubscribes ALTER COLUMN unsubscribed_at SET NOT NULL;