public function Schema::dropConstraint in Drupal driver for SQL Server and SQL Azure 4.1.x
Same name and namespace in other branches
- 4.2.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::dropConstraint()
- 3.1.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::dropConstraint()
- 4.0.x src/Driver/Database/sqlsrv/Schema.php \Drupal\sqlsrv\Driver\Database\sqlsrv\Schema::dropConstraint()
Drop a constraint.
Parameters
string $table: Table name.
string $name: Constraint name.
bool $check: Check if the constraint exists?
2 calls to Schema::dropConstraint()
- Schema::cleanUpPrimaryKey in src/
Driver/ Database/ sqlsrv/ Schema.php - Drop the primary key constraint.
- Schema::dropFieldRelatedObjects in src/
Driver/ Database/ sqlsrv/ Schema.php - Drop the related objects of a column (indexes, constraints, etc.).
File
- src/
Driver/ Database/ sqlsrv/ Schema.php, line 1766
Class
Namespace
Drupal\sqlsrv\Driver\Database\sqlsrvCode
public function dropConstraint($table, $name, $check = TRUE) {
// Check if constraint exists.
if ($check) {
// Do Something.
}
$sql = 'ALTER TABLE {' . $table . '} DROP CONSTRAINT [' . $name . ']';
$this->connection
->query($sql);
$this
->resetColumnInformation($table);
}