You are here

function commerce_file_update_7107 in Commerce File 7

Update field_schema to allow NULL for empty data arrays.

File

./commerce_file.install, line 366
Install, update and uninstall functions this module.

Code

function commerce_file_update_7107(&$sandbox) {
  $data_spec = array(
    'type' => 'blob',
    'size' => 'big',
    'not null' => FALSE,
    'serialize' => TRUE,
    'description' => 'Serialized data containing the license properties.',
  );
  $fields = _update_7000_field_read_fields(array(
    'module' => 'commerce_file',
    'type' => 'commerce_file',
    'storage_type' => 'field_sql_storage',
  ));
  foreach ($fields as $field_name => $field) {
    $tables = array(
      _field_sql_storage_tablename($field),
      _field_sql_storage_revision_tablename($field),
    );
    $data_column = $field['field_name'] . '_data';
    foreach ($tables as $table) {
      db_change_field($table, $data_column, $data_column, $data_spec);
    }
  }
  field_info_cache_clear();
  return t('The Commerce File field tables have been updated to allow NULL for empty data arrays.');
}