how to adjust size of an existing field through api in hook_update? I have a textfield that is part of a field-collection belonging to a content type made in a custom module.
I am looking for a way to expand the size of the field on the update hook of my module.

I've tried the following: 

function spelersfiche_update_7200() {
  field_update_field(array(
    'field_name' =&gt; 'spelersfiche_va_antwoord',
    'cardinality' =&gt; '1',
    'type' =&gt; 'text',
    'settings' =&gt; array(
      'max_length' =&gt; '511',
    )
  ));
}


In this the max_length setting has been increased.
When i try to run the update for my module i get the following error:

The following updates returned messages
spelersfiche module
Update #7200

Failed: FieldUpdateForbiddenException: field_sql_storage cannot change the schema for an existing field with data. in field_sql_storage_field_update_forbid() (line 229 of D:\drupal\volley3\modules\field\modules\field_sql_storage\field_sql_storage.module).


From what i understand it says i can't change this setting for a field that contains data.
But in my case it's just to make the field larger, so any previously contained data should still be able to fit into the field.

Is there any way around this, because uninstalling and reinstalling is what i was trying to avoid since that will delete all the data contained in the field.
If you want to get around the restrictions imposed by the FieldAPI, and you're positive the change won't cause any data loss, you could just do it manually:

$field_name = 'spelersfiche_va_antwoord';

// Get the current settings
$result = db_query('SELECT data FROM {field_config} WHERE field_name = :name', array(':name' =&gt; $field_name))-&gt;fetchField();

// Change the settings
$data = unserialize($result);
$data['settings']['max_length'] = '511';

// Write settings back to the database.
db_update('field_config')
  -&gt;fields(array('data' =&gt; serialize($data)))
  -&gt;condition('field_name', $field_name)
  -&gt;execute();

// Update the value column in both the _data and _revision tables for the field
$new_field = array('type' =&gt; 'varchar', 'length' =&gt; 511);
$col_name = $field_name . '_value';

db_change_field("field_data_$field_name", $col_name, $col_name, $new_field);
db_change_field("field_revision_$field_name", $col_name, $col_name, $new_field);

// Flush the caches
drupal_flush_all_caches();