Closed (fixed)
Project:
Migrate
Version:
7.x-2.5
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Feb 2013 at 13:04 UTC
Updated:
12 Feb 2013 at 16:10 UTC
Is this forum active? Last post from developer is a week ago. I am new here, is this normal?
I am doing a cross-database import. Source is on other database than drupal. Same DB-server, same user for source and Drupal DB. Map Table is created but with out destid1. I did insert the destid1 field manually. After this, migrate import and update works as it should. On rollback, nodes are remaining on destination but maping table is getting empty as it should. I have seen a lot of issues about crossdatabase migration, no one couldn't make it work. Any ides?
<?php
class photo_contest_syncMigration extends Migration {
public function __construct() {
parent::__construct();
$this->description = 'Sync Photocontest Sync';
// External database info
Database::addConnectionInfo('bt', 'default', array(
'driver' => 'mysql',
'database' => '***',
'username' => '***',
'password' => '***',
'host' => 'localhost',
'collation' => 'utf8_general_ci'
));
// Mapping
$this->map = new MigrateSQLMap($this->machineName,
array('nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
)
),
MigrateDestinationTable::getKeySchema(),'bt'
);
$query = Database::getConnection('default', 'bt')
->select('photo_contest_sync', 'pcs')
->fields('pcs');
$this->source = new MigrateSourceSQL($query);
$this->destination = new MigrateDestinationNode('photo_contest_entry');
// Mapped fields
$this->addFieldMapping('title','title');
$this->addFieldMapping('field_pc_cam', 'field_pc_cam');
}
public function prepareRow($row) {
print_r($row);
}
}
/**
* Implements hook_migrate_api().
*
* Register new class und tell Migrapte API to use the API Ver. 2
*/
function photo_contest_sync_migrate_api() {
$api = array(
'api' => 2,
);
return $api;
}
Comments
Comment #1
paralax commented