Probably not a major issue for most users, but there's an odd bug when the module is disabled and re-enabled. It occurs even if the module is un-installed, deleted and re-downloaded.

Error is:

DatabaseSchemaObjectExistsException: Table field_data_commerce_donate_amount already exists. in DatabaseSchema->createTable() (line 657 of [my_path]/includes/database/schema.inc).

Screenshot attached.

Edit: Further to this, refreshing the page causes the error to disappear and everything in the admin side seems fine, however the custom checkout pane does not appear properly. The field set is created, but there is no content within it.

CommentFileSizeAuthor
screenshot.png11.54 KBsagraham

Comments

dooug’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev

I could not replicate the error mentioned above. Can you specific when and where that error shows up?

I did notice that the Donation content type remains after this module is uninstalled. Shouldn't the module clean up in the uninstall process and remove that content type that it created?

I found a work-around to remove the content type that the module did not properly uninstall: http://drupal.stackexchange.com/questions/20709/why-cant-i-delete-certai...

I'm not entirely sure, but it seems this module doesn't correctly install/uninstall the content type. The node_example.module is a reference for properly setting up fields, field instances and content types.

yaworsk’s picture

I was about to post this issue. I was trying to get the decimal format working that was provided in the recent dev version. I uninstalled the module and reinstalled but all the data was still there in the database. Looking in the database both tables field_data_commerce_donate_amount, field_revision_commerce_donate_amount weren't deleted and in the field_config table, commerce_donate_amount still existed as an entry.

I didn't look into the content type donation remaining because I'm not using it but given the field tables don't get removed, I'm assuming the content type doesn't get removed from the node_type table either.

yaworsk’s picture

Issue summary: View changes

Updated to add further information based (presumably) on the same bug.

lsolesen’s picture

Title: Uninstall / Reinstall issue » Uninstall / Reinstall issue field_data_commerce_donate_amount already exists
Issue summary: View changes
stella’s picture

Status: Active » Postponed (maintainer needs more info)

Is this still an issue? I can't reproduce it with latest dev.

weavie’s picture

Yes, this is still an issue as of today with the latest dev installed.
I had Commerce Donate enabled, disabled it and uninstalled it, then reenabled and got this error:
DatabaseSchemaObjectExistsException: Table field_data_commerce_donate_amount already exists. in DatabaseSchema->createTable() (line 657 of /Users/iyn/Sites/iyn/includes/database/schema.inc).

Disabling Commerce donate again and re-enabling it triggers the error again.

Dropping both field_data_commerce_donate_amount and field_revision_commerce_donate_amount before re-enabling Commerce Donate allows it to enable cleanly.

stella’s picture

Status: Postponed (maintainer needs more info) » Fixed

I've added code to commerce_donate_install(), which is responsible for creating the commerce_donate_amount field, checks to see whether the field already exists and then creates or updates as is necessary. So even though the module doesn't remove the field, it shouldn't cause a problem when it is re-enabled.

Lastly, the jury is out on to whether delete fields when a module is uninstalled, particularly when they contain data. There is a rather long and interesting thread on it against the Examples module (which exists to showcase examples of how a given API should/could/might be implemented) and in the end they removed the code which deleted the fields on uninstall: https://www.drupal.org/node/1015846 Without being able to find any clearer documentation on the matter, I'll follow the Examples module for now and not remove the fields on uninstall.

If you find any more authoritative documentation on how to handle fields on uninstall, then I'd be more than happy to follow its advice.

Thanks,
Stella

  • stella committed df1d526 on 7.x-1.x
    Issue #1681234 - handle existing fields upon module re-enable
    

Status: Fixed » Closed (fixed)

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