You are here

protected function Schema::recreateTableKeys in Drupal driver for SQL Server and SQL Azure 8

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

Re-create keys associated to a table.

2 calls to Schema::recreateTableKeys()
Schema::addField in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Override DatabaseSchema::addField().
Schema::changeField in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Override DatabaseSchema::changeField().

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 1297
Definition of Drupal\Driver\Database\sqlsrv\Schema

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

protected function recreateTableKeys($table, $new_keys) {
  if (isset($new_keys['primary key'])) {
    $this
      ->addPrimaryKey($table, $new_keys['primary key']);
  }
  if (isset($new_keys['unique keys'])) {
    foreach ($new_keys['unique keys'] as $name => $fields) {
      $this
        ->addUniqueKey($table, $name, $fields);
    }
  }
  if (isset($new_keys['indexes'])) {
    foreach ($new_keys['indexes'] as $name => $fields) {
      $this
        ->addIndex($table, $name, $fields);
    }
  }
}