You are here

protected function Schema::introspectIndexSchema in Drupal 8

Same name in this branch
  1. 8 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::introspectIndexSchema()
  2. 8 core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php \Drupal\Core\Database\Driver\sqlite\Schema::introspectIndexSchema()
  3. 8 core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php \Drupal\Core\Database\Driver\pgsql\Schema::introspectIndexSchema()
  4. 8 core/lib/Drupal/Core/Database/Driver/mysql/Schema.php \Drupal\Core\Database\Driver\mysql\Schema::introspectIndexSchema()
Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php \Drupal\Core\Database\Driver\sqlite\Schema::introspectIndexSchema()

Finds the columns for the primary key, unique keys and indexes of a table.

Parameters

string $table: The name of the table.

Return value

array A schema array with the following keys: 'primary key', 'unique keys' and 'indexes', and values as arrays of database columns.

Throws

\Drupal\Core\Database\SchemaObjectDoesNotExistException If the specified table doesn't exist.

\RuntimeException If the driver does not implement this method.

Overrides Schema::introspectIndexSchema

File

core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php, line 781

Class

Schema
SQLite implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\Core\Database\Driver\sqlite

Code

protected function introspectIndexSchema($table) {
  if (!$this
    ->tableExists($table)) {
    throw new SchemaObjectDoesNotExistException("The table {$table} doesn't exist.");
  }
  $schema = $this
    ->introspectSchema($table);
  unset($schema['fields']);
  return $schema;
}