You are here

function video_embed_field_update_7005 in Video Embed Field 7.2

Adds data column to field database.

File

./video_embed_field.install, line 201
Install, update and uninstall functions for the video_embed_field module.

Code

function video_embed_field_update_7005() {

  // Get the list of fields of type 'video_embed_field'.
  $video_embed_fields = array();
  foreach (field_info_fields() as $field_name => $field_info) {
    if ($field_info['type'] == 'video_embed_field') {
      $video_embed_fields[$field_name] = field_read_field($field_name);
    }
  }
  foreach ($video_embed_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'] . '_video_data';
    db_add_field($table, $column, array(
      'type' => 'blob',
      'not null' => FALSE,
      'size' => 'big',
      'serialize' => TRUE,
    ));
    db_add_field($revision_table, $column, array(
      'type' => 'blob',
      'not null' => FALSE,
      'size' => 'big',
      'serialize' => TRUE,
    ));
  }
  return t('Data column added. Please clear cache.');
}