-- Migration 975: Add two-factor authentication columns to users table
-- Required by internal/services/two_factor_service.go

ALTER TABLE public.users ADD COLUMN IF NOT EXISTS two_factor_enabled BOOLEAN NOT NULL DEFAULT false;
ALTER TABLE public.users ADD COLUMN IF NOT EXISTS two_factor_secret TEXT DEFAULT '';
ALTER TABLE public.users ADD COLUMN IF NOT EXISTS backup_codes TEXT DEFAULT '';

CREATE INDEX IF NOT EXISTS idx_users_two_factor ON public.users(two_factor_enabled) WHERE two_factor_enabled = true;
