db_drop_field($table, $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. For example, $injected_database->schema()->dropField($table, $field);
See also
\Drupal\Core\Database\Schema::dropField()
Related topics
- Schema API
- API to handle database schemas.
File
- core/includes/database.inc, line 778
- Core systems for the database layer.
Code
function db_drop_field($table, $field) { return Database::getConnection()->schema()->dropField($table, $field); }
Please login to continue.