You are here

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

Same name and namespace in other branches
  1. 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::dropIndex()
  2. 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\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 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Drop the primary key constraint.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 562

Class

Schema

Namespace

Drupal\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;
}