-- 0003_user_credentials.sql -- Create user_credentials table for password storage (extensible for other auth methods) CREATE TABLE user_credentials ( id UUID PRIMARY KEY, user_id UUID NOT NULL REFERENCES users(id), credential_type TEXT NOT NULL DEFAULT 'password', password_hash TEXT, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() ); -- Each user can have at most one credential per type CREATE UNIQUE INDEX user_credentials_user_type_idx ON user_credentials (user_id, credential_type); -- Index for user lookups CREATE INDEX user_credentials_user_id_idx ON user_credentials (user_id);