So I had to reinstall migrate, but before I did, for each of my migrate classes, there were 2 of the same name that showed up when I ran a drush ms.

Now, there is only one. Here is my problem

drush ms User

returns

Group: default         Total  Imported  Unimported  Status  Last imported
 User  122    121       1           Idle    2013-06-01 18:40:45

If I run it, it returns

Processed 122 (0 created, 122 updated, 0 failed, 0 ignored) in 26.3 sec (278/min) - done with 'User'                                                               

As you can see, it tries to update it rather then create a new user. Before, if I ran drush mi User, it would return two lines, one creating a single entry, the other updating all of them. if I were to run it again, with no changes, it would create no users, and update all of them.

I have attached part of my class below.

class MigrateUser extends Migration {
  public function __construct() {
    parent::__construct();
    $this->description = t('Migrate UMSI people into accounts');
     
   
    $this->highwaterField = array(
      'name' => 'LASTUP',  
      'type' => 'int',
    );
    $this->map = new MigrateSQLMap($this->machineName,
      array(
        'UserId' => array(
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'description' => 'UserId',
        )
      ),
      MigrateDestinationNode::getKeySchema()
    );

    // Source fields available from the Oracle table.
    $fields = array(
      'JOBCODE'=>t('Job'),
      'Email' => t('email'),
      'UserID' => t('Id'),
    );
  ##### removed queries. 
    $this->source = new MigrateSourceOracle($conf['oracle_db'], $query, $count_query, $fields);
    $this->destination = new MigrateDestinationUser();


    // Basic fields
 $this->addFieldMapping('mail','mail');
 $this->addFieldMapping('name', 'UserID')->dedupe('users', 'name');
 $this->addFieldMapping('roles','role');
 $this->addFieldMapping('status')->defaultValue(1);
    // Unmapped destination fields
    $this->addUnmigratedDestinations(array('is_new', 'promote',
      'revision', 'language', 'sticky', 'revision_uid', 'path','created','changed','log','tnid'));
  }

  
}

Does anyone have any ideas what was going on before, and why it stopped working now?

Comments

simon.westyn’s picture

I would say that there's something wrong with the unique ID (UserId)

drupalnuts’s picture

That was my thought at first, migrate sees that it is not there, and then it does not add it, it just says it updates it.

drupalnuts’s picture

Status: Active » Closed (works as designed)

This was on my side, sorry for creating an issue for bad sql.