You are here

function text_update_7000 in Drupal 7

Change text field 'format' columns into varchar.

File

modules/field/modules/text/text.install, line 72
Install, update and uninstall functions for the text module.

Code

function text_update_7000() {
  $spec = array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => FALSE,
  );
  $fields = _update_7000_field_read_fields(array(
    'module' => 'text',
    'storage_type' => 'field_sql_storage',
  ));
  foreach ($fields as $field) {
    if ($field['deleted']) {
      $table = "field_deleted_data_{$field['id']}";
      $revision_table = "field_deleted_revision_{$field['id']}";
    }
    else {
      $table = "field_data_{$field['field_name']}";
      $revision_table = "field_revision_{$field['field_name']}";
    }
    $column = $field['field_name'] . '_' . 'format';
    db_change_field($table, $column, $column, $spec);
    db_change_field($revision_table, $column, $column, $spec);
  }
}