You are here

function yamaps_update_7001 in Yandex.Maps 7

Implements hook_update_N().

Change type of the hide column.

File

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

Code

function yamaps_update_7001() {
  $fields = db_select('field_config', 'c')
    ->fields('c', [
    'field_name',
  ])
    ->condition('c.type', 'field_yamaps')
    ->execute()
    ->fetchCol();
  $new_description = [
    'type' => 'int',
    'default' => 0,
    'description' => 'Flag defining whether "Yandex Maps" field should be hidden for end user or not.',
  ];
  foreach ($fields as $field_name) {
    foreach ([
      'field_data',
      'field_revision',
    ] as $table_type) {
      $table_name = $table_type . '_' . $field_name;
      $column = $field_name . '_hide';
      db_change_field($table_name, $column, $column, $new_description);
    }
  }
}