You are here

function yamaps_update_7000 in Yandex.Maps 7

Implements hook_update_N().

Alters yamaps_field schema and adds 'hide' column.

File

./yamaps.install, line 99
Install, update, and uninstall functions for the yamaps module.

Code

function yamaps_update_7000() {
  $fields = field_info_fields();
  foreach ($fields as $field_name => $field) {
    if ($field['type'] == 'field_yamaps' && $field['storage']['type'] == 'field_sql_storage') {
      $schema = yamaps_field_schema($field);
      foreach ($field['storage']['details']['sql'] as $table_info) {
        foreach ($table_info as $table_name => $columns) {
          $column_name = _field_sql_storage_columnname($field_name, 'hide');
          db_add_field($table_name, $column_name, $schema['columns']['hide']);
          db_add_index($table_name, $column_name, [
            $column_name,
          ]);
        }
      }
    }
  }
  field_cache_clear();
}