1

I'm trying to migrate content from an Expression Engine database to Drupal 8.

I set up a $databases['migrate']['default'] in settings.php and copied and modified BeerNode.php from migrate_plus migrate_example module in a custom module. This is my query code in BlogNode.php.

  public function query() {
    // $this->configuration['ignore_map'] = true;
    $query = $this->select('exp_weblog_titles', 'tab1');
    $query->addField('tab1', 'entry_id', 'bid');
    $query->addField('tab1', 'title', 'name');
    $query->addField('tab2', 'field_id_10', 'body');
    $query->innerJoin('exp_weblog_data', 'tab2', 'tab1.entry_id = tab2.entry_id');
    $query->condition('tab1.weblog_id', 10, '=');
    return $query;
  }

Now Drush complains about a missing column:

Migration failed with source plugin exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'b.bid' in 'on clause':

SELECT tab1.entry_id AS bid, tab1.title AS name, tab2.field_id_196 AS body, map.sourceid1 AS migrate_map_sourceid1, map.source_row_status AS
migrate_map_source_row_status
FROM
{exp_weblog_titles} tab1
INNER JOIN {exp_weblog_data} tab2 ON tab1.entry_id = tab2.entry_id
LEFT OUTER JOIN destinationdatabase.migrate_map_blog_node map ON b.bid = map.sourceid1
WHERE  (tab1.weblog_id = :db_condition_placeholder_0) AND( (map.sourceid1 IS NULL ) OR (map.source_row_status = :db_condition_placeholder_1) );

This is the implementation of getIds():

  public function getIds() {
    return array(
      'bid' => array(
        'type' => 'integer',
        'alias' => 'b',
      ),
    );
  }

I assume that the second part of the query should be ON tab1.entry_id = map.sourceid1 but I can't set anything other than bid.

I kind of resolved by temporarily setting $this->configuration['ignore_map'] = true; before the query losing some traking functionality though.

  • In your source you'll have an implementation of getIds(), can you post that here? – benjy Oct 11 '15 at 22:47
  • Yes, b was coming from there, I edited the question, thanks. – Angus Oct 12 '15 at 17:05
0

Remove 'alias' => 'b', from your getIds() call, that parameter is only needed if you need to remove any ambiguity from the source query.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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