You are here

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

Override DatabaseSchema::dropPrimaryKey().

@status tested

Overrides DatabaseSchema::dropPrimaryKey

File

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

Class

DatabaseSchema_sqlsrv

Code

public function dropPrimaryKey($table) {
  if (!$this
    ->primaryKeyName($table)) {
    return FALSE;
  }
  $this->connection
    ->query('ALTER TABLE [{' . $table . '}] DROP CONSTRAINT {' . $table . '_pkey}');
  $this
    ->createTechnicalPrimaryColumn($table);
  $this->connection
    ->query('ALTER TABLE [{' . $table . '}] ADD CONSTRAINT {' . $table . '}_pkey_technical PRIMARY KEY CLUSTERED (__pk)');
  return TRUE;
}