You are here

function units_update_7102 in Units of Measurement 7

Same name and namespace in other branches
  1. 7.2 units.install \units_update_7102()

Implements hook_update_N().

Update to version of Units module, that supports 'exportable' feature for 'units_unit' and 'units_measure' entity types.

File

./units.install, line 167
Install and uninstall hooks of the Units module.

Code

function units_update_7102() {

  // Adding 'status' and 'module' columns to the 'units_unit' and
  // 'units_measure' tables.
  $tables = array(
    'units_unit',
    'units_measure',
  );
  $columns = array(
    'status',
    'module',
  );
  foreach ($tables as $table) {
    $schema = drupal_get_schema($table, TRUE);
    foreach ($columns as $column) {
      if (!db_field_exists($table, $column)) {
        db_add_field($table, $column, $schema['fields'][$column]);
      }
    }
  }
  return t('Updated settings of Units module. Now it supports Features exportables.');
}