rwadurian/backend/mpc-system/migrations/006_make_email_optional.dow...

13 lines
371 B
SQL

-- Revert email field to NOT NULL
-- Drop partial unique index
DROP INDEX IF EXISTS idx_accounts_email_unique;
-- Set email back to NOT NULL (this will fail if there are NULL emails in the table)
ALTER TABLE accounts
ALTER COLUMN email SET NOT NULL;
-- Add back UNIQUE constraint on email
ALTER TABLE accounts
ADD CONSTRAINT accounts_email_key UNIQUE (email);