I've been running into several issues when trying to migrate from a csv to an entity that I created using Entity Construction Kit.
First, using an int as the source_key fails with the following error when I try to run the migration: "General error: 1366 Incorrect integer value: '1' for column 'sourceid1' at row 1". By specifying the source key as a varchar (see below), I can get one step closer.
$this->map = new MigrateSQLMap($this->machineName,
array(
'id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
)
),
MigrateDestinationEntityAPI::getKeySchema()
);
// The following change avoids the first error
$this->map = new MigrateSQLMap($this->machineName,
array(
'orgname' => array(
'type' => 'varchar',
'length' => 60,
'not null' => TRUE,
'description' => 'Company name',
)
),
MigrateDestinationEntityAPI::getKeySchema()
);
However, trying to run the migration at this point leads to the error: "Column not found: 1054 Unknown column 'destid1' in 'field list'". If I then manually add the destid1 column, my migration runs successfully.
At this point, I'm not sure if the issue is coming from migrate_extras or the way it interacts with the entity I created with ECK.
Given that this is a one time import that I can massage to work, I am able to move on at this point. But if I can help diagnose or solve the issue, please let me know.
Comments
Comment #1
a-fro commentedAlso, I should add that the migration appears to be reporting its status correctly (both via drush and according to /admin/content/migrate from migrate_ui), even after rolling back. But the migrated entities fail to be deleted upon rollback.
Comment #2
rickyoh commentedMigrateDestinationEntityAPI::getKeySchema() needs the entity and bundle.
For instance:
MigrateDestinationEntityAPI::getKeySchema('entity_name', 'bundle_name');