0

I have been using the migrate module to migrate users from Drupal 7.59 to Drupal 7.59. I encounter the following error.

Migration for <em class="placeholder">NonDomainUserMigration</em> failed with source plugin exception: <em class="placeholder">SQLSTATE[42S22]: Column not found: 1054     [error]
Unknown column &#039;pgid&#039; in &#039;on clause&#039;</em>, in <em class="placeholder">/app/includes/database/database.inc</em>:<em class="placeholder">2227</em>

What could be the issue? I can't find any pgid column in the drupal database.

the following is my User migration code

<?php
abstract class NonDomainBaseMigration extends Migration {

  // A Migration constructor takes an array of arguments as its first parameter.
  // The arguments must be passed through to the parent constructor.
  public function __construct($arguments) {
    parent::__construct($arguments);

    // With migrate_ui enabled, migration pages will indicate people involved in
    // the particular migration, with their role and contact info. We default the
    // list in the shared class; it can be overridden for specific migrations.
    $this->team = array(
      new MigrateTeamMember('Moses Liao', '[email protected]',
        t('Tech Lead')),
    );

    Database::addConnectionInfo('legacy', 'default', array(
      'driver' => 'mysql',
      'database' => 'zaobao_drupal',
      'username' => 'root',
      'password' => 'password',
      'host' => 'mysqldb',
      'prefix' => '',
    ));
  }
}

class NonDomainUserMigration extends NonDomainBaseMigration {
  public function __construct($arguments) {

    parent::__construct($arguments);
    $this->description = t('Legacy Zaobao Drupal 7 system Users');

    $query = Database::getConnection('default', 'legacy')
    ->select('users', 'u')
    ->fields('u');

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

    $source_key = array(
      'pgid' => array('type' => 'int',
                      'unsigned' => TRUE,
                      'not null' => TRUE,
                      'description' => t('Source ID'),
                     )
    );
    $this->map = new MigrateSQLMap($this->machineName, $source_key,
      MigrateDestinationNode::getKeySchema(), 'legacy', array('track_last_imported' => TRUE));

    $this->addSimpleMappings(
      array(
        'uid',
        'name',
        'pass',
        'mail',
        'theme',
        'signature',
        'signature_format',
        'created',
        'access',
        'login',
        'status',
        'timezone',
        'language',
        'picture',
        'init',
        'data',
      )
    );
  }
}
1
  • You are using a source id key that does not exist. It should be uid.
    – Kevin
    Aug 28, 2018 at 13:02

1 Answer 1

0

its seems to me that pgid is wrong. Should be uid for users

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.