Drupal - Features workflow issue with deleting a field

The correct way to remove Features-created content is via hook_update_N (which should be implemented in the file your_module.install).


The main idea with Features is to manage configuration with code. Using hook_update_N is consistent with that, since the field deletion is in code (which can be managed with version control) — whereas the equivalent command drush field-delete field is not being called from managed code; it's a separate command-line step you need to perform (and to remember to perform).


This is a double edged sword, it's like this to prevent data deletion which is always a good thing. There's nothing really to solve, this is expected behaviour.

It's the same workflow we use and have been doing for over a year and it works really well. I'd say it's correct but that's a very subjective answer.


Create a new file called "your_feature_name.install"

Inside the file declare hook_update_N, there you can use field_delete_field() and specify the name of field that you want to delete as parameter.

Run update.php and the fields will be deleted.

Tags:

7

Features