You are here

function domain_update_7304 in Domain Access 7.3

Rebuild the {domain} table.

File

./domain.install, line 297
Install file.

Code

function domain_update_7304(&$sandbox) {

  // Reset the domain_id field as a plain integer.
  $spec = array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
    'description' => 'Domain numeric id.',
  );
  db_change_field('domain', 'domain_id', 'domain_id', $spec);
  db_drop_primary_key('domain');

  // Add the machine name column.
  if (!db_field_exists('domain', 'machine_name')) {
    $spec = array(
      'type' => 'varchar',
      'length' => '255',
      'not null' => TRUE,
      'default' => '',
      'description' => 'The machine name for this domain.',
    );
    db_add_field('domain', 'machine_name', $spec);
  }

  // Now we can safely add the new primary key.
  db_add_primary_key('domain', array(
    'domain_id',
  ));
  return t('{domain} table updated with machine_name column.');
}