Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Use commerce_delete_field() instead of commerce_delete_fields() in the uninstall hook to delete a single field.
Patch attached.
Comment | File | Size | Author |
---|---|---|---|
commerce_coupon-uninstall.patch | 624 bytes | klausi | |
Comments
Comment #1
deggertsen CreditAttribution: deggertsen commentedWhen 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.
Comment #2
pcambragood 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.