Skip to content

fix(db): Fix zp_entity_relationship table migration issues#3221

Merged
marcelfolaron merged 1 commit intomasterfrom
fix/db-migration
Jan 29, 2026
Merged

fix(db): Fix zp_entity_relationship table migration issues#3221
marcelfolaron merged 1 commit intomasterfrom
fix/db-migration

Conversation

@gloriafolaron
Copy link
Contributor

Summary

Fixes database migration issues where the zp_entity_relationship table doesn't exist or has incorrect schema, causing errors like:

  • Table 'zp_entity_relationship' doesn't exist
  • Dashboard and tickets pages failing to load

Problem

The migration had several issues:

  1. Original migration (update_sql_20115) created zp_entity_relationships (plural) with typo enitityA
  2. Fresh install SQL creates zp_entity_relationship (singular) with correct entityA
  3. Migration update_sql_30410 tried to fix the typo but assumed the singular table exists
  4. Users who already ran broken 30410 had it marked as complete, so fixes to 30410 wouldn't help them

Solution

  • Improved update_sql_30410() for new users who haven't run it yet
  • Added new update_sql_30412() migration for users who already ran the broken version
  • Updated dbVersion to 3.4.12

The new migration handles all scenarios:

  1. Renames plural table (zp_entity_relationships) to singular if it exists
  2. Creates table with correct schema if missing entirely
  3. Fixes column typo (enitityAentityA) if present

Test plan

  • Fresh install: Table created with correct schema
  • Upgrade from old version with plural table: Table renamed and column fixed
  • User who already ran broken 30410: New migration 30412 fixes the issues
  • Dashboard loads without errors
  • Tickets page loads without errors

🤖 Generated with Claude Code

- Add update_sql_30412() to fix table for users who already ran broken 30410
- Handles three scenarios:
  1. Renames plural table (zp_entity_relationships) to singular if exists
  2. Creates table with correct schema if missing
  3. Fixes column typo (enitityA -> entityA) if present
- Update dbVersion to 3.4.12
- Also improved update_sql_30410() for new users who haven't run it yet

Fixes issues where dashboard/tickets fail with:
"Table 'zp_entity_relationship' doesn't exist"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gloriafolaron gloriafolaron requested a review from a team as a code owner January 28, 2026 22:45
@gloriafolaron gloriafolaron requested review from marcelfolaron and pmarcowski and removed request for a team January 28, 2026 22:45
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@marcelfolaron marcelfolaron removed the request for review from pmarcowski January 29, 2026 02:46
@marcelfolaron marcelfolaron merged commit d895964 into master Jan 29, 2026
5 of 6 checks passed
@marcelfolaron marcelfolaron deleted the fix/db-migration branch January 29, 2026 02:47
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.

3 participants