Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
i have an issue to run migrations with the UI
it works fine through drush though, which is what leads me posting here.
i get messages like
Migration MIGRATION_NAME could not be constructed.
The specified database connection is not defined: CONNECTION_TO_SOURCE_NAME
however, items count is correct, so it obviously can connect to the source db...
any hints?
if this helps, here is how i define the connection to the source db in the hook_migrate_api:
<?php
Database::addConnectionInfo('CONNECTION_TO_SOURCE_NAME', 'default', array(
'driver' => 'mysql',
'database' => variable_get('source_db', 'db_name'),
'username' => variable_get('source_username', 'user'),
'password' => variable_get('source_password', 'password'),
'host' => variable_get('source_host', 'localhost'),
'prefix' => '',
));
?>
i might have to set this somewhere else or? why would it work on drush then?
Comments
Comment #2
miaoulafrite CreditAttribution: miaoulafrite commentedyeah so that's it
if i include this connection info to the MIGRATION_NAME class, it does the trick
where shall this be set? i won't repeat this in every class... each implementing different classes (use of migrate d2d)
Comment #3
mikeryanDoing addConnectionInfo in hook_migrate_api() is not helpful - the hook is only called to register migrations, it is not necessarily in play when running migrations. Your connection info belongs in the group arguments, e.g.
See the documentation at https://www.drupal.org/node/1813498.