public function Schema::dropUniqueKey in Drupal driver for SQL Server and SQL Azure 4.1.x
Same name and namespace in other branches
- 4.2.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::dropUniqueKey()
- 3.1.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::dropUniqueKey()
- 4.0.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::dropUniqueKey()
Drop a unique key.
Parameters
$table: The table to be altered.
$name: The name of the key.
Return value
TRUE if the key was successfully dropped, FALSE if there was no key by that name to begin with.
Overrides Schema::dropUniqueKey
1 call to Schema::dropUniqueKey()
- Schema::dropFieldRelatedObjects in src/
Driver/ Database/ sqlsrv/ Schema.php - Drop the related objects of a column (indexes, constraints, etc.).
File
- src/
Driver/ Database/ sqlsrv/ Schema.php, line 470
Class
Namespace
Drupal\sqlsrv\Driver\Database\sqlsrvCode
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}");
$this
->resetColumnInformation($table);
// Try to clean-up the technical primary key if possible.
$this
->cleanUpTechnicalPrimaryColumn($table);
return TRUE;
}