function db_drop_field
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); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!database.inc/function/db_drop_field/8.1.x