You are here

public function Schema::dropField in Drupal driver for SQL Server and SQL Azure 8.2

Same name and namespace in other branches
  1. 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::dropField()
  2. 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::dropField()

Override DatabaseSchema::dropField().

@status complete

Overrides Schema::dropField

3 calls to Schema::dropField()
Schema::changeField in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Override DatabaseSchema::changeField().
Schema::cleanUpPrimaryKey in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Drop the primary key constraint.
Schema::cleanUpTechnicalPrimaryColumn in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Tries to clean up the technical primary column. It will be deleted if (a) It is not being used as the current primary key and... (b) There is no unique constraint because they depend on this column (see addUniqueKey())

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 944
Definition of Drupal\Driver\Database\sqlsrv\Schema

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

public function dropField($table, $field) {
  if (!$this
    ->fieldExists($table, $field)) {
    return false;
  }

  // Drop the related objects.
  $this
    ->dropFieldRelatedObjects($table, $field);
  $this->connection
    ->query('ALTER TABLE {' . $table . '} DROP COLUMN ' . $field);

  // Clear introspection cache.
  $this
    ->getTableIntrospectionInvalidate($table);
  return true;
}