veza/veza-backend-api/migrations/975_add_two_factor_columns.sql
senke 5d1f9a815d fix(backend): add password change endpoint and 2FA migration
- Add PUT /users/me/password inline handler in routes_users.go
  (the existing handler in internal/api/user/ was never registered)
- Create migration 975 adding two_factor_enabled, two_factor_secret,
  and backup_codes columns to users table (fixes 500 on 2FA endpoints)

Fixes: Settings bugs #1 (password 404), #2/#4 (2FA 500)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 23:39:28 +01:00

8 lines
511 B
SQL

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