function _update_7000_field_delete_instance
7.x field.install | _update_7000_field_delete_instance($field_name, $entity_type, $bundle) |
Utility function: delete an instance and all its data of a field stored in SQL Storage.
BEWARE: this function deletes user data from the field storage tables.
This function is valid for a database schema version 7000.
Related topics
1 call to _update_7000_field_delete_instance()
- taxonomy_update_7005 in drupal-7.x/
modules/ taxonomy/ taxonomy.install - Migrate {taxonomy_term_node} table to field storage.
File
- drupal-7.x/
modules/ field/ field.install, line 289 - Install, update and uninstall functions for the field module.
Code
function _update_7000_field_delete_instance($field_name, $entity_type, $bundle) {
// Delete field instance configuration data.
db_delete('field_config_instance')
->condition('field_name', $field_name)
->condition('entity_type', $entity_type)
->condition('bundle', $bundle)
->execute();
// Nuke data.
db_delete('field_data_' . $field_name)
->condition('entity_type', $entity_type)
->condition('bundle', $bundle)
->execute();
db_delete('field_revision_' . $field_name)
->condition('entity_type', $entity_type)
->condition('bundle', $bundle)
->execute();
}