W3cubDocs

/Drupal 8

protected function SqlContentEntityStorageSchema::addIndex

protected SqlContentEntityStorageSchema::addIndex($table, $name, array $specifier, array $schema)

Creates an index, dropping it if already existing.

Parameters

string $table: The table name.

string $name: The index name.

array $specifier: The fields to index.

array $schema: The table specification.

See also

\Drupal\Core\Database\Schema::addIndex()

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 1998

Class

SqlContentEntityStorageSchema
Defines a schema handler that supports revisionable, translatable entities.

Namespace

Drupal\Core\Entity\Sql

Code

protected function addIndex($table, $name, array $specifier, array $schema) {
  $schema_handler = $this->database->schema();
  $schema_handler->dropIndex($table, $name);
  $schema_handler->addIndex($table, $name, $specifier, $schema);
}

© 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!Entity!Sql!SqlContentEntityStorageSchema.php/function/SqlContentEntityStorageSchema::addIndex/8.1.x