Closed (fixed)
Project:
Features
Version:
7.x-2.x-dev
Component:
Field
Priority:
Major
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Feb 2012 at 21:40 UTC
Updated:
4 Jul 2014 at 20:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
russc commentedI think I have the same issue. I created the attached feature ZIP from a customer website, and installed it on a clean 7.12 site with minimum other modules - entity api, entityreference, ctools, views, panels.
When enabling the module I get this error:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'field_ref1_target_type' doesn't exist in table: CREATE TABLE {field_data_field_ref1} ( `entity_type` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The entity type this data is attached to', `bundle` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance', `deleted` TINYINT NOT NULL DEFAULT 0 COMMENT 'A boolean indicating whether this data item has been deleted', `entity_id` INT unsigned NOT NULL COMMENT 'The entity id this data is attached to', `revision_id` INT unsigned NULL DEFAULT NULL COMMENT 'The entity revision id this data is attached to, or NULL if the entity type is not versioned', `language` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The language for this data item.', `delta` INT unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields', `field_ref1_target_id` INT unsigned NULL DEFAULT NULL COMMENT 'The id of the target entity', PRIMARY KEY (`entity_type`, `entity_id`, `deleted`, `delta`, `language`), INDEX `entity_type` (`entity_type`), INDEX `bundle` (`bundle`), INDEX `deleted` (`deleted`), INDEX `entity_id` (`entity_id`), INDEX `revision_id` (`revision_id`), INDEX `language` (`language`), INDEX `field_ref1_target_entity` (`field_ref1_target_type`, `field_ref1_target_id`), INDEX `field_ref1_target_id` (`field_ref1_target_id`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Data storage for field 15 (field_ref1)'; Array ( ) in db_create_table() (line 2688 of C:\Drupal Sites\sites\drupal-7.12\includes\database\database.inc).Comment #2
tim.plunkettYes, that's exactly the error.
Comment #3
elshae commentedSubscribe I'm experiencing this exporting any content with entityreference fields...
However, thanks to timplunkett who helped me through this in IRC, I found a fix for now:
In my case I had an event content type which had an entity reference field of speaker content type. I had made a feature for each and exported my feature made modules to my new site. Everything was fine, except I kept getting the SQL error mentioned above and I could not get the entity reference field to be created in the event content type no matter what. The problem is that target_type was a column in the older versions of entity reference which has been removed but wasn't removed from the features code. When features creates a module for you, it still references this 'target_type'.
Comment out as you see I have done above. 1 => 'target_id' should become 0 => 'target_id'
Run update.php, your entity reference field should be there and the errors should be gone as well.
Comment #4
mpotter commentedComment #5
emjayess commented"works as designed"... really?
Comment #6
tim.plunkettWhoa, I missed that...
Comment #7
mpotter commentedSorry, didn't mean to mark this one closed...too many issues in one day ;)
In any case, I don't see anything I can do to help with this in Features itself. Features is just exporting the $field data array that comes from field_info_field (in 'field_config') and from field_info_instance (in 'field_instance'). You didn't include the full export above so I don't know if you are commenting out something from field_config or field_instance or from somewhere else. But it sounds like the entityreference module is adding a key/value to the field data that is causing this problem.
If somebody can point me to something Features itself is doing to cause this, let me know and I'll look into it again.
Comment #8
hefox commentedI think what needed to happen was
1) Disable rebuild during cache clear (possible in 2.x)
2) update feature after field was updated.
I sounds like features rebuilt the field to re-add in the removed key.