Problem/Motivation

The method Drupal\migrate\Plugin\migrate\id_map\Sql::ensureTables() creates two database tables (map and message) for each migration plugin. Sometimes (perhaps only in tests) we want to create these tables for specific migrations. Currently, the only way to do that is to copy and paste.

Steps to reproduce

See #3063856-63: Add ability to view migrate_message table data.

Proposed resolution

Refactor the code so that it calls a new method, which will create the tables for a single migration.

Make the new method public or move it to a trait so that it can be used in other parts of the codebase.

Remaining tasks

User interface changes

None

API changes

TBD: possible API addition.

Data model changes

None

Release notes snippet

TBD

Comments

benjifisher created an issue. See original summary.

benjifisher’s picture

Perhaps all we need is a way to get the database schema for the map and message tables.

benjifisher’s picture

This issue could also help simplify two other tests:

  • Drupal\Tests\migrate\Unit\MigrateSqlIdMapEnsureTablesTest
  • Drupal\Tests\migrate_drupal\Kernel\d6\NodeMigrateTypeTestTrait

Perhaps the first, since it directly tests the ensureTables() method, should be left as is, but I think it makes sense to simplify the second.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.