Use commerce_delete_field() instead of commerce_delete_fields() in the uninstall hook to delete a single field.

Patch attached.

CommentFileSizeAuthor
commerce_coupon-uninstall.patch624 bytesklausi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deggertsen’s picture

When running uninstall with this patch applied I got this error.

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'my_database.field_data_commerce_coupon_reference' doesn't exist: UPDATE {field_data_commerce_coupon_reference} SET deleted=:db_update_placeholder_0 WHERE (entity_type = :db_condition_placeholder_0) AND (bundle = :db_condition_placeholder_1) ; Array ( [:db_update_placeholder_0] => 1 [:db_condition_placeholder_0] => commerce_line_item [:db_condition_placeholder_1] => commerce_coupon ) in field_sql_storage_field_storage_delete_instance() (line 682 of /public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

I had to revert back in order for uninstall to complete, but of course those two fields were not removed from the database. I have not tried to reproduce on a different drupal install yet.

pcambra’s picture

Status: Needs review » Fixed

good catch! thanks klausi, committed.

@deggertsen the patch is correct, your problems are not related with this one, you problably have a upgraded version that might be kind of broken.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.