protected function DatabaseSchema_sqlsrv::recreatePrimaryKey in Drupal driver for SQL Server and SQL Azure 7
Same name and namespace in other branches
- 7.3 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::recreatePrimaryKey()
- 7.2 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::recreatePrimaryKey()
1 call to DatabaseSchema_sqlsrv::recreatePrimaryKey()
- DatabaseSchema_sqlsrv::changeField in sqlsrv/
schema.inc - Override DatabaseSchema::changeField().
File
- sqlsrv/
schema.inc, line 654 - Database schema code for Microsoft SQL Server database servers.
Class
Code
protected function recreatePrimaryKey($table, $primary_key_sql) {
// Drop the existing primary key if exists.
if ($existing_primary_key = $this
->primaryKeyName($table)) {
$this->connection
->query('ALTER TABLE [{' . $table . '}] DROP CONSTRAINT [' . $existing_primary_key . ']');
}
$this->connection
->query('ALTER TABLE [{' . $table . '}] ' . $primary_key_sql);
}