Skip to content

Fix - Prevent MySQL table name overflow during GenericObject to CustomAsset migration#1127

Open
RomainLvr wants to merge 2 commits intomainfrom
fix/fields-table-name-length-genericobject-migration
Open

Fix - Prevent MySQL table name overflow during GenericObject to CustomAsset migration#1127
RomainLvr wants to merge 2 commits intomainfrom
fix/fields-table-name-length-genericobject-migration

Conversation

@RomainLvr
Copy link
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

  • It fixes !41693
  • Here is a brief description of what this PR does

Fixes table name overflow error during Fields plugin migration from GenericObject to CustomAssets in GLPI 11.0.

Problem

When migrating Fields containers associated with GenericObject items to native CustomAssets, the generated MySQL table names exceeded the 64-character limit:

  • glpi_plugin_fields_glpicustomassetliaisonassetliaisonsautresinfos (65 chars)

This caused migration failures with error:

MySQL query error: Identifier name '...' is too long (1059)

Solution

Use abbreviated prefix gca (GLPI CustomAsset) instead of glpicustomasset:

  • glpi_plugin_fields_gcaliaisonassetliaisonsautresinfos (53 chars) ✓

This approach:

  • Saves 11 characters, providing sufficient margin
  • Prevents name collisions (no container name truncation needed)
  • Maintains consistency across all CustomAsset migrations
  • Automatically applies to both table renames and new file generation

Changes

  • Modified installBaseData() migration logic to use gca prefix
  • Updated getSystemName() to apply abbreviation for Glpi\CustomAsset\* itemtypes
  • Added clear error message if table name still exceeds limit

@RomainLvr RomainLvr requested review from Rom1-B and stonebuzz February 5, 2026 09:01
@RomainLvr RomainLvr self-assigned this Feb 5, 2026
@RomainLvr RomainLvr added the bug label Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant