You are here

public function Schema::dropIndex in Drupal driver for SQL Server and SQL Azure 8

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. 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::dropIndex()

Override DatabaseSchema::dropIndex().

@status tested

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 1623
Definition of Drupal\Driver\Database\sqlsrv\Schema

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 . '}]');

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