New users not created when migrate source is nodes instead of users I'm working on a D6-> D7 user migration where I need the source to be a node, not a user. To get around the restriction of only one author per node, in the source D6 site we created a Source content type, and then in other node types (article, video, etc), we created field_source as a node reference field to reference Source nodes.

So now, in my user migration to D7, I need to get the data from the Source nodes instead of users. Here's what I have so far.

/**
 * Override of DrupalUser6Migration.
 */
class CNSUserMigration extends DrupalUser6Migration {
  public function __construct($arguments) {
    parent::__construct($arguments);

    $this-&gt;addFieldMapping('name', 'title');
    // Set a default password for all users.
    $this-&gt;addFieldMapping('pass')-&gt;defaultValue('Pass!234');
    $this-&gt;addFieldMapping('field_twitter', 'field_twitter_id_value')-&gt;description('Twitter ID');
    $this-&gt;addFieldMapping('field_job_title', 'field_source_title_value')-&gt;description('Job title');
    $this-&gt;addFieldMapping('field_bio', 'body')-&gt;description('Bio');

    // By default, the primary key is the uid from the users table,
    // but since our user source is a source nid, need to replace
    // uid with the nid of the source node.
    $this-&gt;map = new MigrateSQLMap($this-&gt;machineName,
      array(
        'nid' =&gt; array('type' =&gt; 'int',
          'unsigned' =&gt; TRUE,
          'not null' =&gt; TRUE,
          'description' =&gt; 'Source node nid',
          'alias' =&gt; 'n',
        ),
      ),
      DrupalDestinationUser::getKeySchema()
    );
  }

  /**
   * Override of DrupalUser6Migration::query()
   *
   * @return mixed
   */
  protected function query() {
    // Create query from scratch to get source nodes referenced from field_source
    $query = Database::getConnection('default', $this-&gt;sourceConnection)
      -&gt;select('node', 'n')
      -&gt;fields('n', array('nid', 'title'));
    $query-&gt;innerJoin('content_field_source', 'cfs', 'cfs.field_source_nid = n.nid');
    $query-&gt;innerJoin('content_type_source', 'cts', 'cts.nid = cfs.field_source_nid');
    $query-&gt;fields('cts', array('field_source_title_value', 'field_twitter_id_value'));
    $query-&gt;innerJoin('node_revisions', 'nr', 'n.nid = nr.nid');
    $query-&gt;fields('nr', array('body'));
    $query-&gt;distinct();

    return $query;
  }
}


So my query works fine and gets all the relevant Source nodes, but when I ran it the first time, I realized I had to change my source PK to be the nid of the Source node instead of the default uid from the users table. As you can see above, I overrode the map with a new MigrateSQLMap object in my constructor.  However, when I run the migration, it creates the first user from the query, but then all of the subsequent source records also point to that first new user instead of creating new users. Now that I've defined a new source PK, do I also need to do something on the destination side to cause it to create new users?

Thanks.
Since you know SQL, It would be simpler and definitely quicker to use SQL and SELECT the users from the source nodes and INSERT it into the user table rather than attempting to write a PHP script.