You are here

public function Schema::dropIndex in Drupal driver for SQL Server and SQL Azure 4.1.x

Same name and namespace in other branches
  1. 4.2.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::dropIndex()
  2. 3.1.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::dropIndex()
  3. 4.0.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::dropIndex()

Drop an index.

Parameters

$table: The table to be altered.

$name: The name of the index.

Return value

TRUE if the index was successfully dropped, FALSE if there was no index by that name to begin with.

Overrides Schema::dropIndex

1 call to Schema::dropIndex()
Schema::cleanUpPrimaryKey in src/Driver/Database/sqlsrv/Schema.php
Drop the primary key constraint.

File

src/Driver/Database/sqlsrv/Schema.php, line 524

Class

Schema

Namespace

Drupal\sqlsrv\Driver\Database\sqlsrv

Code

public function dropIndex($table, $name) {
  if (!$this
    ->indexExists($table, $name)) {
    return FALSE;
  }
  $expand = FALSE;
  if (($index = $this
    ->tableHasXmlIndex($table)) && $index == $name . '_idx') {
    $expand = TRUE;
  }
  $this->connection
    ->query('DROP INDEX ' . $name . '_idx ON {' . $table . '}');
  $this
    ->resetColumnInformation($table);

  // If we just dropped an XML index, we can re-expand the original primary
  // key index.
  if ($expand) {
    $this
      ->compressPrimaryKeyIndex($table);
  }
  return TRUE;
}