You are here

protected function SqlContentEntityStorageSchema::addIndex in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addIndex()
  2. 9 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 2518

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