public function Schema::compressPrimaryKeyIndex in Drupal driver for SQL Server and SQL Azure 3.0.x
Same name and namespace in other branches
- 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::compressPrimaryKeyIndex()
- 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::compressPrimaryKeyIndex()
Compress Primary key Index.
Sometimes the size of a table's primary key index needs to be reduced to allow for Primary XML Indexes.
Parameters
string $table: Table name.
int $limit: Limit size.
2 calls to Schema::compressPrimaryKeyIndex()
- Schema::addIndex in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Add an index.
- Schema::dropIndex in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Drop an index.
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php, line 1620
Class
Namespace
Drupal\Driver\Database\sqlsrvCode
public function compressPrimaryKeyIndex($table, $limit = 900) {
// Introspect the schema and save the current primary key if the column
// we are modifying is part of it.
$primary_key_fields = $this
->introspectPrimaryKeyFields($table);
// SQL Server supports transactional DDL, so we can just start a transaction
// here and pray for the best.
$transaction = $this->connection
->startTransaction();
// Clear current Primary Key.
$this
->cleanUpPrimaryKey($table);
// Recreate the Primary Key with the given limit size.
$this
->createPrimaryKey($table, $primary_key_fields, $limit);
}