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

miaoulafrite created an issue. See original summary.

miaoulafrite’s picture

yeah 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)

mikeryan’s picture

Project: Migrate » Drupal-to-Drupal data migration
Version: 7.x-2.8 » 7.x-2.x-dev
Component: migrate_ui » Code
Category: Bug report » Support request
Status: Active » Fixed

Doing 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.

  $api = array(
    'api' => 2,
    'groups' => array(
      'mygroup' => array(
        'title' => t('My group'),
        'arguments' => array(
          'source_connection' => 'CONNECTION_TO_SOURCE_NAME',
          'source_database' => 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' => '',
          ),
        ),
      ),

See the documentation at https://www.drupal.org/node/1813498.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.