Problem/Motivation

Drupal 7 vocabularies have the following fields:

  • vid (numeric)
  • machine_name (varchar 255)
  • name

Currently the D8 vid, which is a unique machine readable string, is mapped from Drupal 7 'name'.

  • This is most probably because Drupal 6 vocabularies only had 'vid' and 'name' and the approach in D6-D8 migration is that we transfrom 'name' to unique machine readable string from 'name'.
  • So D6-D8 migration for D8 vocabulary vid is OK but D7-D8 is confusing because D7 vocabularies have a 'machine_name' field.

What increases the severity of this D7-D8 issue is that vocabulary 'name' is on the primary language of the D7 site. When we migrate the vocabulary from the 'name' field, the result is unexpected especially for the Tags vocabulary which is created in both D7 and D8 Standard installation profiles. See screenshot below.

Screenshot showing duplicate tags vocabulary

What happens here is that D7 has a vocabulary with 'machine_name' tags and 'name' Tagit. When this is migrated to D8, a vocabulary with 'vid' tagit is created. However, D8 Standard already had a vocabulary with vid tags so we now have two vocabularies for tags.

Note regarding the Forum vocabulary. As illustrated in the screenshot above, also Forum vocabulary is duplicated. However, Forum needs special handling which is handled separately in #2914249: Translated forum vocabulary migration creates duplicate forum vocabularies. .

Proposed resolution

D7-D8 vocabulary migration should map D8 vid from D7 'machine_name' instead of 'name'. We still need to pass the D7 'machine_name' source property through make_unique_entity_field process plugin because the D7 'machine_name' can be 255 characters long and D8 'vid' can only have 32 characters.

Remaining tasks

Patch
Review
Commit
Dance all night, one bug less :)

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

masipila created an issue. See original summary.

masipila’s picture

Issue summary: View changes
FileSize
31.09 KB
masipila’s picture

This should be straight forward, I'll try to patch this right away.

masipila’s picture

Let's see what the testbot says for this.

I checked that this bug does not affect D6-D8 migration. The vocabularies in D6 have only 'vid' and 'name', they don't have machine_name. Hence: mapping from 'name' is OK for D6-D8.

Cheers,
Markus

masipila’s picture

Status: Active » Needs review
masipila’s picture

Removed the machine_name process plugin as it will not be needed. We still need to pass the source value through make_unique_entity_field because machine_name is VARCHAR(255) in D7 and vid can't be more than 32 characters in D8.

masipila’s picture

Issue summary: View changes

Issue summary updated to help reviewers.

masipila’s picture

Assigned: masipila » Unassigned
FileSize
2.86 KB
2.06 KB
2.06 KB

This latest patch should also include the test coverage for this.

  • We had a previous fixture which I modified so that the vocabulary name and machine name are clearly different.
  • This way the test will catch this bug, 2914649-fail.patch should fail in the testbot.

Cheers,
Markus

masipila’s picture

Title: Vocabulary migration: machine_name incorrectly mapped from vocabulary name » [D7] Vocabulary migration: vid incorrectly mapped from vocabulary name instead of machine_name
masipila’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 8: 2914649-fail.patch, failed testing. View results

maxocub’s picture

Status: Needs work » Reviewed & tested by the community

I think this is right. The failing patch shows the current bug, and the fix is quite straight forward. RTBCed.

phenaproxima’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs issue summary update

+1 for RTBC; the problem, and its fix, make sense to me. Nice work, @masipila.

My only problem with this is that the issue summary is confusing, since the first thing it talks about, and steps to reproduce, concern the translation snafu. So it's not obvious that this patch addresses a subset of that problem.

Can this be clarified in the IS? For even more clarity's sake, should we postpone #2914249: Translated forum vocabulary migration creates duplicate forum vocabularies on this, even though that issue is RTBC?

maxocub’s picture

Re #13: #2914249: Translated forum vocabulary migration creates duplicate forum vocabularies does not have to be postponed, they are independent.

I removed the translation wording in the IS since we can change the vocabulary names on a single language site.

maxocub’s picture

Issue summary: View changes

Fix IS typos.

masipila’s picture

Issue summary: View changes
masipila’s picture

Issue summary: View changes

I re-wrote the issue summary to help reviewers.

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

The IS is nice and clear, like the patch. Back to RTBC.

catch’s picture

Priority: Normal » Critical
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

This needs a re-roll now the other two issues are in, but otherwise looks good.

dipakmdhrm’s picture

Assigned: Unassigned » dipakmdhrm
dipakmdhrm’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
2.64 KB
2.07 KB

There were merge conflicts.

After the patch in #8, another plugin was added by one of the forum issues to map the vid.

Though this patch passes the MigrateTaxonomyVocabularyTest, I wonder if we need to make any changes to the plugin added by the form issue.

Please review.

Status: Needs review » Needs work

The last submitted patch, 21: 2914649-fail.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Needs review

The fail patch, she failed testing as expected. Back to NR!

There were merge conflicts.

Yep, this is why patches occasionally need rerolls :)

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Reroll looks good to me. Let us proceed.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!

  • catch committed 50caae0 on 8.5.x
    Issue #2914649 by masipila, dipakmdhrm, phenaproxima, maxocub: [D7]...

  • catch committed 3f2e9fd on 8.4.x
    Issue #2914649 by masipila, dipakmdhrm, phenaproxima, maxocub: [D7]...

Status: Fixed » Closed (fixed)

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