Database error when execute drush migrate:status
سؤال
I'm trying to do a 'file to media' migration on a d8 installation. Following the readme on the module I have created a custom module and created the two yaml files. After enabling the module and drush ms
i get the following error:
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed
The error appears on my local (DDEV) and my production environment. Drush works otherwise. drush sql-cli
works.
I think i'm missing something. Do i have to set a database reference somewhere? Happy to provide additional information when needed, as i'm clueless atm.
Thanks for pointing me in the right direction.
Edit:
output of drush ms -v
Exception trace:
at myproject/docroot/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php:416
PDO->__construct() at myproject/docroot/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php:416
Drupal\Core\Database\Driver\mysql\Connection::open() at myproject/docroot/core/lib/Drupal/Core/Database/Database.php:374
Drupal\Core\Database\Database::openConnection() at myproject/docroot/core/lib/Drupal/Core/Database/Database.php:169
Drupal\Core\Database\Database::getConnection() at myproject/docroot/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php:201
Drupal\migrate\Plugin\migrate\source\SqlBase->setUpDatabase() at myproject/docroot/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php:154
Drupal\migrate\Plugin\migrate\source\SqlBase->getDatabase() at myproject/docroot/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php:221
Drupal\migrate\Plugin\migrate\source\SqlBase->checkRequirements() at myproject/docroot/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php:112
Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase->checkRequirements() at myproject/docroot/modules/contrib/metatag/src/Plugin/migrate/source/d7/MetatagFieldInstanceDeriver.php:69
Drupal\metatag\Plugin\migrate\source\d7\MetatagFieldInstanceDeriver->getDerivativeDefinitions() at myproject/docroot/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php:101
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives() at myproject/docroot/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php:87
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() at myproject/docroot/core/modules/migrate/src/Plugin/MigrationPluginManager.php:262
Drupal\migrate\Plugin\MigrationPluginManager->findDefinitions() at myproject/docroot/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:175
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() at myproject/docroot/core/modules/migrate/src/Plugin/MigrationPluginManager.php:109
Drupal\migrate\Plugin\MigrationPluginManager->createInstances() at myproject/docroot/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php:697
Drupal\migrate_tools\Commands\MigrateToolsCommands->migrationsList() at myproject/docroot/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php:135
Drupal\migrate_tools\Commands\MigrateToolsCommands->status() at n/a:n/a
call_user_func_array() at myproject/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at myproject/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at myproject/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
Consolidation\AnnotatedCommand\CommandProcessor->process() at myproject/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:302
Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at myproject/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at myproject/vendor/symfony/console/Application.php:1005
Symfony\Component\Console\Application->doRunCommand() at myproject/vendor/symfony/console/Application.php:255
Symfony\Component\Console\Application->doRun() at myproject/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at myproject/vendor/drush/drush/src/Runtime/Runtime.php:118
Drush\Runtime\Runtime->doRun() at myproject/vendor/drush/drush/src/Runtime/Runtime.php:49
Drush\Runtime\Runtime->run() at myproject/vendor/drush/drush/drush.php:72
require() at myproject/vendor/drush/drush/includes/preflight.inc:18
drush_main() at phar:///usr/local/bin/drush/bin/drush.php:143
require() at /usr/local/bin/drush:10
Update2: I have tried the whole process with a vanilla drupal 8.9.11, some manually created nodes with managed files (image) and all worked like a charm. So there must be something in my project going wrong.
المحلول
I have (finally!) resolved the problem:
- Starting from scratch
- I had setup a new Thunder distribution with Drupal 9.1.0 (Thunder 6.1.1)
- Instead of using the UI-version of migrate-update i did the migration from the d7 source with drush. For this the source database was additionally imported into the ddev-environment.
- After this was done, the file to media migration worked without database errors.