You are here

protected function Schema::recreatePrimaryKey in Drupal driver for SQL Server and SQL Azure 3.0.x

Same name and namespace in other branches
  1. 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::recreatePrimaryKey()
  2. 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::recreatePrimaryKey()

Recreate primary key.

Drops the current primary key and creates a new one. If the previous primary key was an internal primary key, it tries to cleant it up.

Parameters

string $table: Table name.

mixed $fields: Array of fields.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 1264

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

protected function recreatePrimaryKey($table, $fields) {

  // Drop the existing primary key if exists, if it was a TPK
  // it will get completely dropped.
  $this
    ->cleanUpPrimaryKey($table);
  $this
    ->createPrimaryKey($table, $fields);
}