You are here

function db_drop_field in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/database.inc \db_drop_field()

Drops a field.

Parameters

$table: The table to be altered.

$field: The field to be dropped.

Return value

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

Deprecated

as of Drupal 8.0.x, will be removed in Drupal 9.0.0. Instead, get a database connection injected into your service from the container, get its schema driver, and call dropField() on it. E.g. $injected_database->schema()->dropField($table, $field);

See also

\Drupal\Core\Database\Schema::dropField()

Related topics

1 call to db_drop_field()
SchemaTest::assertFieldAdditionRemoval in core/modules/system/src/Tests/Database/SchemaTest.php
Asserts that a given field can be added and removed from a table.

File

core/includes/database.inc, line 770
Core systems for the database layer.

Code

function db_drop_field($table, $field) {
  return Database::getConnection()
    ->schema()
    ->dropField($table, $field);
}