Hello,

modules like menu_item extras build bundle names for menu link content entities in this format: 'header-top'. So, we need to create yml files whose name is like 'menu_link_content.header-top.yml' or similar.

That leads to bugs and errors when building the migration ID, that would be something like 'mdc_menu_link_content_header-top'. That value is invalid and throws an error when trying to import:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-top (
`source_ids_hash` VARCHAR(64) NOT NULL COMMENT 'Hash of s' at line 1

Here I'm proposing a way to normalize migration names to avoid this kind of issues.

Best,
Pablo

CommentFileSizeAuthor
#2 normalize_name-3157417-2.patch2.72 KBplopesc

Comments

plopesc created an issue. See original summary.

plopesc’s picture

Title: Conflicts with menu_item extras or bundles using '-' instead of '_¡ » Conflicts with menu_item extras or bundles using '-' instead of '_'
Status: Active » Needs review
StatusFileSize
new2.72 KB

Patch attached

Status: Needs review » Needs work

The last submitted patch, 2: normalize_name-3157417-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rvilar’s picture

Status: Needs work » Needs review

It sounds good to me. Do you think it could have any impact wit our previous migrations or with any other characters? I don't think so, but I prefer to ask before push it to the repository.

plopesc’s picture

Hey Ramon.

I don't think so. We have a big battery of default content in our current site and everything is still working.

This is a very specific use case where machine names are not following the usual rule, lowercase letters, numbers and underscores.

Thank you for your quick response!

rodrigoaguilera’s picture

I don't see any conflict with this change as bundle names can already have underscores and the patch just forces to have all in underscores.
The ability to get the bundle name from the migration id is lost but this module is not doing that anywhere.

My only nitpick is to change the method name from migrationName to buildMigrationName but I won't block the patch for that.

rodrigoaguilera’s picture

Status: Needs review » Fixed

I changed the method name in a subsequent commit.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.