You are here

protected function DatabaseSchema_sqlsrv::recreateTableKeys in Drupal driver for SQL Server and SQL Azure 7

Same name and namespace in other branches
  1. 7.3 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::recreateTableKeys()
  2. 7.2 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::recreateTableKeys()

Re-create keys associated to a table.

2 calls to DatabaseSchema_sqlsrv::recreateTableKeys()
DatabaseSchema_sqlsrv::addField in sqlsrv/schema.inc
Override DatabaseSchema::addField().
DatabaseSchema_sqlsrv::changeField in sqlsrv/schema.inc
Override DatabaseSchema::changeField().

File

sqlsrv/schema.inc, line 666
Database schema code for Microsoft SQL Server database servers.

Class

DatabaseSchema_sqlsrv

Code

protected function recreateTableKeys($table, $new_keys) {
  if (isset($new_keys['primary key'])) {
    $this
      ->addPrimaryKey($table, $new_keys['primary key']);
  }
  if (isset($new_keys['unique keys'])) {
    foreach ($new_keys['unique keys'] as $name => $fields) {
      $this
        ->addUniqueKey($table, $name, $fields);
    }
  }
  if (isset($new_keys['indexes'])) {
    foreach ($new_keys['indexes'] as $name => $fields) {
      $this
        ->addIndex($table, $name, $fields);
    }
  }
}