You are here

protected function Schema::recreateTableKeys 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::recreateTableKeys()
  2. 8 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
Add a new field to a table.
Schema::changeField in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Change a field definition.

File

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

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);
    }
  }
}