On this page
protected function Schema::_createKeys
protected Schema::_createKeys($table, $new_keys)
File
- core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php, line 799
Class
- Schema
- PostgreSQL implementation of \Drupal\Core\Database\Schema.
Namespace
Drupal\Core\Database\Driver\pgsqlCode
protected function _createKeys($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) {
// Even though $new_keys is not a full schema it still has 'indexes' and
// so is a partial schema. Technically addIndex() doesn't do anything
// with it so passing an empty array would work as well.
$this->addIndex($table, $name, $fields, $new_keys);
}
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!pgsql!Schema.php/function/Schema::_createKeys/8.1.x