Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I get the following error when trying to revert a content type feature after a new field was added to the feature:
WD php: FieldUpdateForbiddenException: field_sql_storage cannot change the schema for an [error]
existing field with data. in field_sql_storage_field_update_forbid() (line 272 of
/vagrant/html/modules/field/modules/field_sql_storage/field_sql_storage.module).
Cannot modify header information - headers already sent by (output started at [warning]
/usr/share/php/drush/includes/output.inc:38) bootstrap.inc:1233
FieldUpdateForbiddenException: field_sql_storage cannot change the schema for an existing field with data. funktiossa field_sql_storage_field_update_forbid() (rivi 272 tiedostossa /vagrant/html/modules/field/modules/field_sql_storage/field_sql_storage.module).
Drush command terminated abnormally due to an unrecoverable error. [error]
Feature diff which illustrates to bug:
Component type: field_base
),
'type' => 'node_reference',
< ),
< 'field_pro_points' => array(
< 'active' => 1,
< 'cardinality' => 1,
< 'field_name' => 'field_pro_points',
< 'module' => 'number',
< 'type' => 'number_integer',
),
'field_shoulder_rotation_points' => array(
Component type: field_instance
'type' => 'node_reference_autocomplete',
'weight' => 4,
< ),
< ),
< 'node-capability_test_results-field_pro_points' => array(
< 'bundle' => 'capability_test_results',
< 'display' => array(
< 'default' => array(
< 'label' => 'above',
< 'module' => 'number',
< 'settings' => array(
< 'decimal_separator' => '.',
< 'prefix_suffix' => TRUE,
< 'thousand_separator' => ' ',
< ),
< 'type' => 'number_integer',
< 'weight' => 43,
< ),
< 'teaser' => array(
< 'label' => 'above',
< 'type' => 'hidden',
< ),
< ),
< 'entity_type' => 'node',
< 'field_name' => 'field_pro_points',
< 'label' => 'Pro points',
< 'widget' => array(
< 'module' => 'number',
< 'type' => 'number',
< 'weight' => 33,
),
),
As you can see the problem is with the diff doing a near miss of the actual change. It tries to change the preceding field base, which hasn't changed.
As a work around, manually adding the field base allows you to get the feature up to date, but defeates the purpose of using Features.
Comments
Comment #1
mpotter CreditAttribution: mpotter commentedI cannot reproduce this issue. Can you provide a step-by-step procedure for reproducing this on a clean site?
Comment #2
hefox CreditAttribution: hefox at Phase2 commentedIs your feature changing a field in a way that the ui would not allow? That is what the error is indicating.
Comment #3
kekkisI don't have a step-by-step guide but I can provide a URL that explains what the problem is with diff being too eager:
http://fabiensanglard.net/git_code_review/diff.php (the example about functhreehalves).