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
Comment #2
benjifisherPerhaps all we need is a way to get the database schema for the map and message tables.
Comment #3
benjifisherThis issue could also help simplify two other tests:
Drupal\Tests\migrate\Unit\MigrateSqlIdMapEnsureTablesTestDrupal\Tests\migrate_drupal\Kernel\d6\NodeMigrateTypeTestTraitPerhaps the first, since it directly tests the
ensureTables()method, should be left as is, but I think it makes sense to simplify the second.