You are here

function wsconfig_update_7001 in Web Service Data 7

Implements hook_update_N().

Add a machine name to each wsconfig

File

modules/wsconfig/wsconfig.install, line 129
Installation tasks for wsconfig

Code

function wsconfig_update_7001(&$sandbox) {
  $field = array(
    'description' => 'Human-readable name of the web service config.',
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  );
  $keys = array(
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );

  // Rename existing "name" column to "title"
  db_change_field('wsconfig', 'name', 'title', $field);

  // Adjust the column definition for the new 'name' column
  $field['description'] = 'The machine name of a wsconfig.';

  // Add new "name" column to store machine name
  db_add_field('wsconfig', 'name', $field, $keys);
}