column seems to be missing from map table: "Column not found: 1054 Unknown column 'destid2' in 'field list':"

Created on 21 June 2012, about 13 years ago
Updated 4 May 2025, 2 months ago

I'm getting this error for each row I import:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'destid2' in 'field list': INSERT INTO {migrate_map_greavesproduct} (sourceid1, sourceid2, needs_update, destid1, destid2) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4_0); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 11300033020 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 22 [:db_insert_placeholder_4_0] => 22 ) (sites/all/modules/contrib/migrate/plugins/sources/sqlmap.inc:317)

This is a column that's missing from the map table for this particular migration. My map is declared thus:

    $this->map = new MigrateSQLMap($this->machineName,
      array(
        'product_id' => array(
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'description' => "Product mapping ID from the CSV",
        ),
        'gs_ref' => array(
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'description' => "The product code",
        ),
      ),
      // Need to specify the entity type.
      MigrateDestinationEntityAPI::getKeySchema('commerce_product')
    );

...which all looks fine to me :)

I've checked the return value of MigrateDestinationEntityAPI::getKeySchema('commerce_product'), and it produces two keys, the product ID and revision ID. But there's only one destination column in the map table.

I've looked at other destination classes in Migrate, and none that I can see return more than 1 key in their getKeySchema().

Might this be a bug in Migrate that we're hitting?

🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024