The hosting server I am using is Pantheon. I'm trying to migrate taxonomy over from D6 to D7 with a custom migration class. The problem is that I'm getting different behaviors on my local repo and the one on the server. On the server, I get an error saying that
Migration failed with source plugin exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'legacy_database_name.migrate_map_tdmchanneltermparent' doesn't exist, in /srv/bindings/3b34ee5b39e94f12ad1de632af512a5b/code/includes/database/database.inc:2171
I'm not sure why it is trying to connect to the legacy database for the map in this migration.
Here is my migration class:
class chalkTermParentMigration extends tdmTermMigration {
public function __construct($arguments) {
parent::__construct($arguments);
$this->arguments = $arguments;
$this->description = t('Chalk Term Parent Migration');
$query = Database::getConnection('mig_dest', 'legacy')
->select('vocabulary', 'v');
$or = db_or()->condition('v.vid', 10)
->condition('v.vid', 11, '=')
->condition('v.vid', 12, '=')
->condition('v.vid', 20, '=')
->condition('v.vid', 21, '=')
->condition('v.vid', 25, '=');
$query->condition($or);
$query->fields('v', array('vid', 'name'));
$this->source = new MigrateSourceSQL($query);
$this->destination = new MigrateDestinationTerm('chalk');
$this->addFieldMapping('name', 'name');
$this->addFieldMapping('field_legacy_id', 'vid');
$source_key = array(
'vid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'Legacy Vocab ID',
)
);
$this->map = new MigrateSQLMap($this->machineName, $source_key, MigrateDestinationTerm::getKeySchema());
}
}
Here is how I have my legacy database connection information set up:
if (!defined(PANTHEON_ENVIRONMENT)) {
$databases['mig_dest']['default'] = array(
'database' => 'abc',
'username' => 'abcdev',
'password' => 'qwe123',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
);
$databases['default'] = $databases['mig_dest'];
} else {
$databases['mig_dest']['default'] = array(
'database' => $_ENV['DB_NAME'],
'username' => $_ENV['DB_USER'],
'password' => $_ENV['DB_PASSWORD'],
'host' => $_ENV['DB_HOST'],
'port' => $_ENV['DB_PORT'],
'driver' => 'mysql',
'prefix' => '',
);
}
$databases['legacy']['default'] = array(
'database' => 'legacy_db_name',
'username' => 'uname',
'password' => 'passwd',
'host' => 'legacy_db_host',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
);