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 DDEV 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:
ddev 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):
ddev drush --yes en migrate_drupal migrate_plus migrate_tools migrate_upgrade
- 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' => 'ddev-<sitename>-db',
'port' => 3306,
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
- Clear caches. Then verify that Drupal 9 can connect to the Drupal 7 database:
ddev drush cr; ddev $(drush sql-connect --database=migrate)
- Run migrate:upgrade --configure-only to get the migration YAML files:
ddev drush --yes migrate:upgrade --legacy-db-key='migrate' --legacy-root='http://ddev-<sitename>-web' --configure-only
- Export the configuration to code:
ddev drush --yes config:export
@travisbutterfield I noticed that the link to the article on Aquia dev blog is no longer valid. I also found that on step 4 I was unable to connect to run the "ddev $(drush sql-connect --database=migrate)" command when I added the DB info to the settings.local.php file but when I added this to the settings.php I was able to connect. Maybe something I missed while setting up the local ddev environment.