function field_sql_storage_field_update_forbid

Implements hook_field_update_forbid().

Forbid any field update that changes column definitions if there is any data.

File

modules/field/modules/field_sql_storage/field_sql_storage.module, line 292

Code

function field_sql_storage_field_update_forbid($field, $prior_field, $has_data) {
    if ($has_data && $field['columns'] != $prior_field['columns']) {
        throw new FieldUpdateForbiddenException("field_sql_storage cannot change the schema for an existing field with data.");
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.