protected function Schema::cleanUpPrimaryKey in Drupal driver for SQL Server and SQL Azure 4.2.x
Same name and namespace in other branches
- 3.1.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::cleanUpPrimaryKey()
- 4.0.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::cleanUpPrimaryKey()
- 4.1.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::cleanUpPrimaryKey()
Drop the primary key constraint.
Parameters
mixed $table: Table name.
7 calls to Schema::cleanUpPrimaryKey()
- Schema::addField in src/
Driver/ Database/ sqlsrv/ Schema.php - Add a new field to a table.
- Schema::changeField in src/
Driver/ Database/ sqlsrv/ Schema.php - Change a field definition.
- Schema::compressPrimaryKeyIndex in src/
Driver/ Database/ sqlsrv/ Schema.php - Compress Primary key Index.
- Schema::dropField in src/
Driver/ Database/ sqlsrv/ Schema.php - Should this be in a Transaction?
- 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 1881
Class
Namespace
Drupal\sqlsrv\Driver\Database\sqlsrvCode
protected function cleanUpPrimaryKey($table) {
// We are droping the constraint, but not the column.
$existing_primary_key = $this
->primaryKeyName($table);
if ($existing_primary_key !== FALSE) {
$this
->dropConstraint($table, $existing_primary_key, FALSE);
}
// We are using computed columns to store primary keys,
// try to remove it if it exists.
if ($this
->fieldExists($table, self::COMPUTED_PK_COLUMN_NAME)) {
// The TCPK has compensation indexes that need to be cleared.
$this
->dropIndex($table, self::COMPUTED_PK_COLUMN_INDEX);
$this
->dropField($table, self::COMPUTED_PK_COLUMN_NAME);
}
// Try to get rid of the TPC.
$this
->cleanUpTechnicalPrimaryColumn($table);
}