Drupal Commerce Field Deletion Failure After Uninstall

I thought i’d share with everyone a helpful solution to a nasty bug in drupal / drupal commerce

Issue:

You’re excited. A new drupal module version is released. You’re trying to upgrade and now you’re ridden with a fatal error.

Problem:

There’s a nasty bug in Drupal entity fields that is currently trying to be sorted out. When you upgrade you may be unable to fully upgrade because modules are unable to delete previous database fields. It’s best if you uninstall then reinstall particular modules. There’s no direct path to upgrading for some particular modules Dependant on the entity field system.

At this moment of writing, when you upgrade a module there’s not a way to delete existing entity fields in the database. They’re currently working on this issue in drupal 7/8.

Thus, when you upgrade modules there will be lots of zombie fields in your drupal database. So when you upgrade you’ll

Solution:

  1. Backup your database.
  2. The only way of dealing with this issue is to manually delete all the database fields in drupal.
  3. Using a script remove the database fields: Commerce Clean up Script for versions alpha2-alpha4 (Use with lots of caution. I do not provide any warrantee for this script):

Related Drupal.org Issue queues:
Drupal Commerce uninstall field failure: https://www.drupal.org/node/858722
Drupal Commerce Uninstall Instructions: https://www.drupal.org/node/858722#comment-4165896