Files
ds-galo/backend/migrations/000013_user_phone.up.sql
T

7 lines
377 B
SQL

-- A second login identifier: phone (E.164), nullable and unique. Email becomes
-- optional so phone-only accounts are possible; the "at least one identifier"
-- rule is enforced in the application layer.
ALTER TABLE users ALTER COLUMN email DROP NOT NULL;
ALTER TABLE users ADD COLUMN IF NOT EXISTS phone text;
ALTER TABLE users ADD CONSTRAINT users_phone_key UNIQUE (phone);