WellNuo/backend/migrations/009_add_custom_name.sql
Sergei 4bdfa69dbe feat(api): Add custom_name field to user_access table
Allow users to set custom display names for their beneficiaries
(e.g., "Mom", "Dad" instead of the real name). The custom_name
is stored per-user in user_access, so different caregivers can
have different names for the same beneficiary.

Changes:
- Migration 009: Add custom_name column to user_access
- API: Return customName in GET /me/beneficiaries endpoints
- API: New PATCH /me/beneficiaries/:id/custom-name endpoint
- Types: Add customName to Beneficiary interface
- api.ts: Add updateBeneficiaryCustomName method

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-22 12:34:38 -08:00

18 lines
757 B
SQL

-- Migration 009: Add custom_name to user_access
-- Description: Allows users to give custom names to their beneficiaries
-- Date: 2025-01-22
-- Add custom_name column to user_access table
-- This allows each accessor to have their own custom name for a beneficiary
-- Example: "Mom", "Dad", "Grandma" instead of the beneficiary's real name
ALTER TABLE user_access
ADD COLUMN IF NOT EXISTS custom_name VARCHAR(100);
-- Add comment for documentation
COMMENT ON COLUMN user_access.custom_name IS 'Custom display name set by the accessor for this beneficiary (e.g., "Mom", "Dad")';
-- Verify the change
SELECT column_name, data_type, character_maximum_length
FROM information_schema.columns
WHERE table_name = 'user_access' AND column_name = 'custom_name';