Skip to content

fix(server): store null instead of empty string for user name#30106

Open
deveshkolte wants to merge 1 commit into
immich-app:mainfrom
deveshkolte:fix/28832-user-name-null
Open

fix(server): store null instead of empty string for user name#30106
deveshkolte wants to merge 1 commit into
immich-app:mainfrom
deveshkolte:fix/28832-user-name-null

Conversation

@deveshkolte

Copy link
Copy Markdown

Description

When a user is created (via admin panel or signup), the database now stores NULL instead of an empty string "" for the name column when no name is provided.

This was already marked with a TODO comment in the entity definition:

// TODO remove default, make nullable, and convert empty spaces to null

Changes:

  • DB column: nullable with default NULL; migration updates existing rows
  • Response schemas (UserResponse, LoginResponse, SyncUserV1): allows null
  • Input schemas (UserUpdateMe, UserAdminCreate, UserAdminUpdate, SignUp): transform empty string to null
  • TypeScript types (User, AuthUser): name is string | null

Fixes #28832 (user.name column)

How Has This Been Tested?

  • Pattern follows the same approach as the already-merged person.name fix
  • Existing test suite passes

Checklist:

  • I have carefully read CONTRIBUTING.md
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

None. I manually wrote the code following the established pattern from a previously merged PR for the same issue.

@immich-push-o-matic

immich-push-o-matic Bot commented Jul 21, 2026

Copy link
Copy Markdown

Label error. Requires exactly 1 of: changelog:.*. Found: 🗄️server. A maintainer will add the required label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prefer null values over empty strings

1 participant