Wrong langcode in node table due to wrong Query in d7_node_complete Source Plugin.

Created on 26 July 2022, over 2 years ago
Updated 18 July 2024, 6 months ago

Problem/Motivation

Wrong langcode in node table due to wrong Query in d7_node_complete Source Plugin.

Steps to reproduce

  1. Needs Drupal 7 site with:
    • entity translation enabled
    • language enabled: en, de, it
    • at least one existing node with original language English and translations in Italian and German
  2. Needs Drupal 9 site with translation enabled.
  3. Enable modules (migrate_plus, migrate, migrate_tools, migrate_drupal, migrate_drupal_ui, drupal_upgrade) in Drupal 9 site
  4. Make sure a proper Drupal 7 DB configuration should be exists in settings.php file.
  5. Run migrations.

The node_field_data.langcode and node_field_data.content_translation_source fields have the correct value.
The node.langcode field has the wrong value set to "de" (instead of "en")

Proposed resolution

Change the orderBy and use etr.source instead of etr.language so that the first content created is that with the original language

Remaining tasks

In the next comment the proposed patch

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Migration 

Last updated 1 day ago

Created by

🇮🇹Italy robertom

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • @theodorosploumis opened merge request.
  • 🇬🇷Greece TheodorosPloumis Greece

    We have the some problem on a migration from a 7.x multilingual Drupal (using module entity_translation ) where the sorting of the revisions cause new Nodes on the 10.x Drupal to have a wrong "Original language" (source).

    The sorting was like this (for an "en/de/nl/fr" language setup):

    vid=1, language=de
    vid=1, language=en
    vid=1, language=fr
    vid=1, language=nl
    

    The solution was to add an extra sortBy the "created" column because the source translation revision is always created first. After the patch the sorting was:

    vid=1, language=en
    vid=1, language=de
    vid=1, language=fr
    vid=1, language=nl
    

    Even with this patch we need to add specific Tests.

Production build 0.71.5 2024