function SqlContentEntityStorageSchema::addIndex

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addIndex()
  2. 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addIndex()
  3. 10 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addIndex()

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()

3 calls to SqlContentEntityStorageSchema::addIndex()
SqlContentEntityStorageSchema::createSharedTableSchema in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Creates the schema for a field stored in a shared table.
SqlContentEntityStorageSchema::updateDedicatedTableSchema in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Updates the schema for a field stored in a shared table.
SqlContentEntityStorageSchema::updateSharedTableSchema in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Updates the schema for a field stored in a shared table.

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.