-- 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);