10 lines
532 B
SQL
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;
|