protected function Schema::createKeysSql

3 calls to Schema::createKeysSql()
Schema::addField in drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Add a new field to a table.
Schema::changeField in drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Change a field definition.
Schema::createTableSql in drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Generate SQL to create a new table from a Drupal schema definition.

File

drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php, line 263
Definition of Drupal\Core\Database\Driver\mysql\Schema

Class

Schema

Namespace

Drupal\Core\Database\Driver\mysql

Code

protected function createKeysSql($spec) {
  $keys = array();
  if (!empty($spec['primary key'])) {
    $keys[] = 'PRIMARY KEY (' . $this
      ->createKeysSqlHelper($spec['primary key']) . ')';
  }
  if (!empty($spec['unique keys'])) {
    foreach ($spec['unique keys'] as $key => $fields) {
      $keys[] = 'UNIQUE KEY `' . $key . '` (' . $this
        ->createKeysSqlHelper($fields) . ')';
    }
  }
  if (!empty($spec['indexes'])) {
    foreach ($spec['indexes'] as $index => $fields) {
      $keys[] = 'INDEX `' . $index . '` (' . $this
        ->createKeysSqlHelper($fields) . ')';
    }
  }
  return $keys;
}