1

I'm getting the following error:

Migration failed with source plugin exception Migration failed with source plugin exception: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'posmsoftllc' for column 'sourceid1' at row 1

I can't figure out why I'm getting this error.

It has something to do with my MigrateSQLMap - there's no real primary key on the source database, but I suppose username would probably work. I've got the MigrateSQLMap setup as follows:

$this->map = new MigrateSQLMap($this->machineName, array(
  'Username' => array('type' => 'varchar',
    'length' => 75,
    'unsigned' => FALSE,
    'not null' => FALSE,
  )
    ), MigrateDestinationEntityAPI::getKeySchema('commerce_line_item', 'recurring')
);

But I'm receiving this error - what could be causing this? Why is it expecting an integer value? Do I even need this map for a successful migration?

1

I find when I get these errors it is because initially I make an sqlmap using an integer key -- then see I don't have an integer key and try to change it. The migration still expects the initial configuration of an int key. You likely have to clear it out as seen in this issue comment.

Everything looks OK to me. Is it possible that when you initially defined your migration, you had an integer key in the MigrateSQLMap call? Changing the key in the code will not automatically change the associated tables. What you can do is:

  1. Rollback the AttSubject migration, so the map and message tables are empty.
  2. Drop the migrate_map_attsubject and migrate_message_attsubject tables.
  3. Run "drush ms". This should call the ensureTables() method and recreate the map and message tables using your ca_varchar1 key schema.
  4. Check the structure of the map and message tables and make sure sourceid1 is a varchar in both.

Also see this issue which describes the same problem and solution with more examples/details.

  • Ah, yes, I initially did have it set as an INT field. – Jack Ryan Nov 26 '14 at 17:57
  • @AndrewAlexander ya migrate is realllly powerful, but it has tiny gotchas like this that can drive you crazy :) kudos on your success! – tenken Nov 26 '14 at 18:04

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.