Using some of the information from this article, and information from a few other sources, I have come up with a procedure for connecting two separate local Lando containers for Drupal 7 to Drupal 9 migration work.
- Create your Drupal 7 container from the source. In this case, we will be using a Pantheon-based website.
- Follow these directions to set up a local version of your Pantheon site.
- Create your new Webspark 2 (Drupal 9) site in Pantheon.
- Follow these instructions to create your Pantheon D9 site.
- Install and enable modules in the new D9 site. (If you want to migrate content from D7 that is related to a module in any way, you will have to install that module in your D9 site, or the Migrate API won’t know to include it.)
- Use Composer to require modules:
lando composer require 'drupal/migrate_plus:^5.1' 'drupal/migrate_tools:^5.0' 'drupal/migrate_upgrade:^3.2'
- Enable modules using Drush (this includes some core and migration modules, but you can enable whatever you need):
lando drush --yes en migrate_drupal migrate_plus migrate_tools migrate_upgrade block_content comment contact datetime file image link options path taxonomy text ckeditor editor field_ui menu_link_content menu_ui toolbar views views_ui media media_library layout_builder layout_discovery responsive_image datetime_range telephone
- Use Composer to require modules:
- Add drupal7 database connection info to the web/sites/default/settings.php or web/sites/default/settings.local.php file in the D9 site:
$databases['migrate']['default'] = array (
'database' => 'db',
'username' => 'db',
'password' => 'db',
'prefix' => '',
'host' => 'database.<sitename>.internal',
'port' => 3306,
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
- Clear caches. Then verify that Drupal 9 can connect to the Drupal 7 database:
lando drush cr; lando $(drush sql-connect --database=migrate)
- Run migrate:upgrade --configure-only to get the migration YAML files:
lando drush --yes migrate:upgrade --legacy-db-key='migrate' --legacy-root='http://<sitename>.lndo.site' --configure-only
- Export the configuration to code:
lando drush --yes config:export