Maping table is created but with not destid1 field. On source database map table is not created at all. Do i have to change to ver 2.5?

class migrate_fr_newsletter_subscriberMigration extends Migration {

  public function __construct() {
    parent::__construct();
    $this->description = 'Subscriber table';


    // external database info
    Database::addConnectionInfo('canal3_fr', 'default', array(
        'driver' => 'mysql',
        'database' => 'xxxx',
        'username' => 'xxxx',
        'password' => 'xxxx',
        'host' => 'xxxx',
        'collation' => 'utf8_general_ci'
    ));

    
    // connection
    $connection = Database::getConnection('default', 'canal3_fr');
    $table_name = 'simplenews_subscriber';

    $this->map = new MigrateSQLMap($this->machineName,
                    array('snid' => array(
                            'type' => 'int',
                            'unsigned' => TRUE,
                            'not null' => TRUE,
                        )
                    ),
                    MigrateDestinationTable::getKeySchema(),
                    'default'
    );

    $query = $connection
            ->select('simplenews_subscriber', 'ns')
            ->fields('ns')
            ->condition('activated', 1);

    $this->source = new MigrateSourceSQL($query);
    $this->destination = new MigrateDestinationTable($table_name);

    // Mapped fields
    $this->addFieldMapping('activated', 'activated');
    $this->addFieldMapping('mail', 'mail');
    $this->addFieldMapping('uid', 'uid');
    $this->addFieldMapping('language', 'language');
    $this->addFieldMapping('timestamp', 'timestamp');
    $this->addFieldMapping('changes', 'changes');
    $this->addFieldMapping('created', ' created');
  }

}

Comments

paralax’s picture

Status: Active » Closed (fixed)