You are here

public function DatabaseSchema_sqlsrv::dropUniqueKey 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::dropUniqueKey()
  2. 7.2 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::dropUniqueKey()

Override DatabaseSchema::dropUniqueKey().

@status tested

Overrides DatabaseSchema::dropUniqueKey

1 call to DatabaseSchema_sqlsrv::dropUniqueKey()
DatabaseSchema_sqlsrv::dropFieldRelatedObjects in sqlsrv/schema.inc
Drop the related objects of a column (indexes, constraints, etc.).

File

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

Class

DatabaseSchema_sqlsrv

Code

public function dropUniqueKey($table, $name) {
  if (!$this
    ->uniqueKeyExists($table, $name)) {
    return FALSE;
  }
  $this->connection
    ->query('DROP INDEX ' . $name . '_unique ON [{' . $table . '}]');
  $this->connection
    ->query('ALTER TABLE [{' . $table . '}] DROP COLUMN __unique_' . $name);

  // Try to clean-up the technical primary key if possible.
  $this
    ->cleanUpTechnicalPrimaryColumn($table);
}