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.
I've tried to revert computed field from feature and got the next error:
FieldUpdateForbiddenException: field_sql_storage cannot change the schema for an existing field with data. in field_sql_storage_field_update_forbid() (line 236 of /home/drupalpro/websites/hof.loc/docroot/modules/field/modules/field_sql_storage/field_sql_storage.module).
The reason of that was comparing default value '0' (integer) with empty string '' in computed_field.install:
if ($settings['database']['data_default'] != '') {
$columns['value']['default'] = $settings['database']['data_default'];
}
This condition returns FALSE so got changed field schema and as the result the exception.
Patch attached.
Comment | File | Size | Author |
---|---|---|---|
computed_field-wrong_default_value_while_feature_reverting.patch | 702 bytes | drupalway |
Comments
Comment #1
illeace CreditAttribution: illeace commentedI was running into this same problem and confirm that it fixes that error.
Comment #2
hughworm CreditAttribution: hughworm commentedJust had to apply this patch (fixed thanks!). Any chance it could at least get into the dev version? (It's taken me nearly 2 hours to chase this bug down :-0 )
Comment #4
ram4nd CreditAttribution: ram4nd at Wunder commented