You are here

function office_hours_update_7102 in Office Hours 7

Add a Comment column.

1 call to office_hours_update_7102()
office_hours_update_7100 in ./office_hours.install
Change value of 'day' column from 0-13 range to normal 0-6 day range.

File

./office_hours.install, line 54
Install, update and uninstall functions for the Office hours module.

Code

function office_hours_update_7102() {
  $db_columns = array(
    'comment' => array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => FALSE,
    ),
  );
  $fields = field_info_fields();
  foreach ($fields as $field_name => $field) {
    if ($field['type'] == 'office_hours') {
      $schema = array(
        'columns' => $db_columns,
      );
      foreach ($field['storage']['details']['sql'] as $type => $table_info) {
        foreach ($table_info as $table_name => $columns) {
          $column_name = _field_sql_storage_columnname($field_name, 'comment');
          if (!db_field_exists($table_name, $column_name)) {
            db_add_field($table_name, $column_name, $schema['columns']['comment']);
          }
        }
      }
    }
  }
  field_cache_clear();
}