You are here

function brightcove_field_update_7201 in Brightcove Video Connect 7.2

Same name and namespace in other branches
  1. 7.3 brightcove_field/brightcove_field.install \brightcove_field_update_7201()
  2. 7.4 brightcove_field/brightcove_field.install \brightcove_field_update_7201()
  3. 7.5 brightcove_field/brightcove_field.install \brightcove_field_update_7201()

Updates the schema of the brightcove field if possible.

File

brightcove_field/brightcove_field.install, line 29

Code

function brightcove_field_update_7201() {
  if (module_exists('field_sql_storage')) {
    $coldef = array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => FALSE,
    );
    foreach (field_info_fields() as $name => $def) {
      if ($def['type'] == 'brightcove_video' && $def['storage']['type'] == 'field_sql_storage') {
        $tablename = _field_sql_storage_tablename($def);
        $revtablename = _field_sql_storage_revision_tablename($def);
        $playercol = _field_sql_storage_columnname($name, 'player');
        db_add_field($tablename, $playercol, $coldef);
        db_add_field($revtablename, $playercol, $coldef);
      }
    }
    db_delete('cache_field')
      ->execute();
  }
}