-- Add phone validation fields to users table
-- Migration: Add phone number validation columns

-- Add phone columns (nullable for optional phone numbers)
ALTER TABLE users ADD COLUMN phone VARCHAR(20) DEFAULT NULL;
ALTER TABLE users ADD COLUMN phone_validated INTEGER DEFAULT 0;
ALTER TABLE users ADD COLUMN phone_validation_hash VARCHAR(64) DEFAULT NULL;

-- Create index for phone lookups
CREATE INDEX IF NOT EXISTS idx_users_phone ON users(phone);
CREATE INDEX IF NOT EXISTS idx_users_phone_validation_hash ON users(phone_validation_hash);

-- Add comment for documentation
-- SQLite does not support COMMENT ON COLUMN, so we use comments in SQL instead
-- phone: User phone number in E.164 format (e.g., +1234567890)
-- phone_validated: Whether phone number has been validated (0=false, 1=true)
-- phone_validation_hash: Hash for phone validation (cleared after validation)
