Rename the user's name to display name and let users edit it

Database · PostgreSQL · intermediate · modification

Renames the user's `name` to `display_name` and lets users change it. `migrations/0043_rename_users_name.sql` renames the column. `app/users.py` reads and writes `display_name` and adds `PATCH /api/me`, which validates the new name and returns the updated profile. `tests/test_profile.py` (new) covers reading the profile, updating the name and the empty and too-long 422 cases.

Accounts API: FastAPI 0.115 on Python 3.12 with psycopg 3.2 (plain SQL, no ORM; `app.db.pool` is a `psycopg_pool.ConnectionPool`, at most 10 connections per pod, and `pool.connection()` commits when its block exits without an error), PostgreSQL 16, one primary. `users` (migration `0001`, unchanged: `id bigint` identity primary key, `email text NOT NULL UNIQUE`, `name text NOT NULL`, `created_at timestamptz NOT NULL DEFAULT now()`) holds about 60,000 rows. Rows are inserted only by `create_user`, which the existing signup flow (`app/signup.py`, unchanged) calls positionally as `create_user(conn, email, name)` inside its transaction; before this PR nothing updated a user's name. `app.auth.current_user_id` (existing) is a FastAPI dependency that returns the signed-in user's id or answers 401, and `app/main.py` (existing) includes `users.router`. Migrations are plain SQL files in `migrations/`, applied in order by the existing runner `python -m app.migrate` (unchanged): each pending file runs as one transaction with `SET LOCAL lock_timeout = '5s'` (retried up to 3 times on a lock timeout) and is recorded in `schema_migrations` in the same transaction. Deploys: the pipeline runs the runner against the production database first; if it fails, the deploy stops. It then replaces the 8 API pods one at a time, each new pod taking traffic once it is healthy, which takes about ten minutes, and until a pod is replaced it keeps serving on the previous release. The web and mobile clients do not call `PATCH /api/me` until a later client release, after this rollout. Removing a column is done in a separate cleanup release once no running code uses it (team convention). The test suite (`tests/conftest.py`, existing) builds a fresh test database from all migrations and provides `db` (an autocommit connection to it, `users` emptied before each test) and `client_for(user_id)` (a test client signed in as that user).

Requirements

Files touched

Review this PR

Database practice