Skip to content

fix: add missing data column to user_profiles migration#755

Merged
lane711 merged 1 commit intomainfrom
lane711/fix-user-edit-page
Apr 8, 2026
Merged

fix: add missing data column to user_profiles migration#755
lane711 merged 1 commit intomainfrom
lane711/fix-user-edit-page

Conversation

@lane711
Copy link
Copy Markdown
Collaborator

@lane711 lane711 commented Apr 8, 2026

Summary

  • The user edit page (/admin/users/:id/edit) crashes with a 500 error because the user_profiles table is missing the data column
  • PR feat: add configurable user profile fields plugin #747 added code querying SELECT ... data FROM user_profiles but placed the migration file in the wrong directory (src/db/migrations/ instead of migrations/), so it was never bundled or executed
  • Adds the missing column via both the CREATE TABLE (fresh installs) and a new ALTER TABLE migration (existing databases)

Changes

File Description
packages/core/migrations/032_user_profiles.sql Add data TEXT DEFAULT '{}' to CREATE TABLE
packages/core/migrations/035_user_profiles_data_column.sql New ALTER TABLE migration for existing DBs
packages/core/src/db/migrations-bundle.ts Regenerated to include migration 035
my-sonicjs-app/migrations/018_user_profiles.sql Add data column for app-level consistency
packages/core/src/db/migrations/0011_user_profiles_data.sql Removed (was in wrong directory)

Root Cause

PR #747 (configurable user profile fields plugin) introduced a migration file 0011_user_profiles_data.sql in packages/core/src/db/migrations/. However, the migration generator script (scripts/generate-migrations.ts) reads from packages/core/migrations/. The migration was never bundled, so the data column was never created, causing the user edit page to crash when it queries that column.

Testing

  • TypeScript compilation passes (tsc --noEmit)
  • Migrations bundle regenerated successfully with 34 migrations
  • Migration runner already handles duplicate column errors gracefully
  • E2E tests (CI)

Checklist

  • Code follows project conventions
  • No new TypeScript errors introduced
  • Existing e2e test 38-user-profile-edit.spec.ts covers this page

🤖 Generated with Claude Code

The user edit page (/admin/users/:id/edit) crashes with a 500 error
because the user_profiles table is missing the `data` column. PR #747
added code querying this column but placed the migration in the wrong
directory (src/db/migrations/ instead of migrations/), so it was never
bundled or executed.

- Add data column to migration 032 CREATE TABLE (fresh installs)
- Add migration 035 ALTER TABLE for existing databases
- Add data column to app-level migration 018
- Remove misplaced 0011_user_profiles_data.sql
- Regenerate migrations bundle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lane711 lane711 merged commit 891da1c into main Apr 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant