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.
Cannot Uninstall Field Collection Module for the life of me.
I tried deleting the database tables in PHPmyadmin.
Are there any dependencies or other things I can try?
Comments
Comment #1
markabur CreditAttribution: markabur commentedSame here. I've disabled it, but it doesn't show up on the Uninstall tab like other modules do.
Comment #2
Hopiu CreditAttribution: Hopiu commentedSame here. It's not even possible to disable the module as it is
But under fields collections it says:
Is it safe to just delete the module from the filesystem?
Comment #3
danon1981 CreditAttribution: danon1981 commented+1
Comment #4
kscheirerBug confirmed - this seems pretty serious. Steps to reproduce:
Workaround: the easiest way to uninstall this module
drush sqlq "update system set status = 0 where type = 'module' and name = 'field_collection'"
Comment #5
siramsay CreditAttribution: siramsay commented+1
Comment #6
mexicoder CreditAttribution: mexicoder commentedTo uninstall this module
Go to the module list
In field collection click the link field list
Find your fields listed as field collection and click 'delete instances'
Your module will now say fields pending deletion
Run cron
You can now disable the module then uninstall the normal way through drush or using the interface
Comment #7
tristanbradley CreditAttribution: tristanbradley commented+1
Comment #8
puzl CreditAttribution: puzl commentedEdit: Read #6. You should run cron.
Comment #9
markosef CreditAttribution: markosef commentedI had same problem. Helped flushing cache and running cron, probably only cron was what did that. Also before that did delete content type with field collection. Too bad this module is so buggy as number of issues shows that it is highly needed.
Comment #10
mexicoder CreditAttribution: mexicoder commentedHi Guys
did you go through each of the steps in #6? The cron run is pretty important and I'd definitely recommend trying these steps before any more drastic DB actions.
Comment #11
m1r1k CreditAttribution: m1r1k commented#6 and #10 are right, you will not be able to disable or uninstall field_collection until there are any field collection items. You need to delete all field collection entries to Drupal be sure nothing will be broken (hard safe mode :) the same stuff with already used options in List fields). You can check which fields are required Field Collection here www.your-site.com/admin/reports/fields. And after you will delete fields from UI, you HAVE to run cron, because Drupal doesn't delete them after first attempt :) It just renames table (add deleted_ prefix), but 'field_config' and 'field_config_instance' tables still think these fields exist. Check here https://api.drupal.org/api/drupal/modules!field!field.crud.inc/function/... for more info.
Comment #12
kscheirerI think this may be related:
http://stackoverflow.com/questions/13608852
https://drupal.org/node/1203876
Comment #13
davewilly CreditAttribution: davewilly commentedI was getting this Log message after deleting Field Collection values and fields from a Content Type:
EntityFieldQuery->addFieldCondition() (line 765 of /home/_____/public_html/includes/entity.inc).
I also couldn't delete the module:
--@-- [~/public_html/sites/all/modules]# drush dis field_collection
field_collection is a required module and can't be disabled. Reason: Fields pending deletion
I fixed it by running field_purge_batch(1000);
Comment #14
kopeboy CreditAttribution: kopeboy commentedGuys, I don't have any field collection field, still I can't disable the module.
Maybe it was imported via Features from another site where I had a field collection, but know I don't have any and I don't know how to disable this module (which is giving me errors..)
If i'm sure I am not currently using any field collection, can I safely delete the module folder from the server?
Or, how can I execute "drush sqlq "update system set status = 0 where type = 'module' and name = 'field_collection'" from comment #4 if I don't have drush/terminal access on the live site?
Comment #15
mexicoder CreditAttribution: mexicoder commented@kopeboy have you done all of the steps in #6?
Comment #16
Wolf_22 CreditAttribution: Wolf_22 commentedSo let me get this straight...
The only way to remove a module is by first removing a bunch of fields?
Comment #17
mexicoder CreditAttribution: mexicoder commented@Wolf_22 yes unfortunately everything is in #6
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedI don't have any fields and did the step as said in #6, but I still cannot disable the module. Ran cron 50 times, cc all 50 times, still nothing. To try I added field fields in field_collection and deleted again, still nothing changes.
Field report doesn't say any field as field_collection... as there is none....
This is major Bug in field_collection module. I updated to recent version as of now i.e. 1.0-beta-7 but still same issue.
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedHoly Lord, I fixed this for me.... (sorry not the bug fix)
Those who are looking for quick fix:
Log into database and ->
Select * from field_config where type = "field_collection"
Delete the rows
Same with field config instance table like
SELECT * FROM field_config_instance where entity_type = "field_collection";
Get rid of those.
No need to run cron, go to http://sitename/sites/admin/modules and disable Field Collection module. I was even able to uninstall without any issue now.
Edit: I should have been more clear here...
The steps I followed is almost exact as #6,
1.) first remove all the fields inside the Fields Collection.
2.) Then remove the field collection from the content type
3.) Run the Cron
4.) try to disable the module, if you cannot then Go ahead with my query statements above
Comment #20
mexicoder CreditAttribution: mexicoder commentedI can only post this so many times, but yes there is an inherent problem with the way this module works, the safest way to uninstall this is to do each of the steps in #6 in the same order, you may have to run cron a number of times. I'd never recommend using direct queries to resolve this issue.
Comment #21
jmuzz CreditAttribution: jmuzz commentedI this really a problem with Field Collections? I have used other modules that supply a field and most of them don't allow me to deactivate them when there is an instance of the field type. I think it is built into the way Drupal handles field types that are supplied by modules.
Comment #22
mexicoder CreditAttribution: mexicoder commentedNo jmuzz ou are right, this problem doesn't apply just to this module, there is a fix but you'd be talking about quite a lot or refactoring
Comment #23
jmuzz CreditAttribution: jmuzz commentedIf I understand the issue correctly it doesn't apply just to contributed modules either. If you have a node with a text field you can't deactivate the text module in core. So my question is, how is there "an inherent problem with the way this module works" ? Isn't this just how fields work?
Comment #24
kscheirerField Collection just makes the problem worse, but it isn't the root of the problem as mexicoder pointed out. People often run into this bug when trying out Field Collection and then trying to remove it.
Comment #25
jmuzz CreditAttribution: jmuzz commentedHow is it a bug though? I don't think you are supposed to be able to uninstall a module when it is supplying a field that is being used in a bundle.
Comment #26
mexicoder CreditAttribution: mexicoder commented@jmuzz, no there is a fix which relates to how and where the fields are controlled within the module, so it's not a bug per se but as I suggested an inherent problem with the module, i.e it works in a certain way which combines with an issue within Drupal and the way it handles fields, the fix addresses this but as I say you'd be talking about refactoring and maybe a bit of a messy upgrade path
Comment #27
iphan CreditAttribution: iphan commented#19 fixed it. Thank you!
Comment #28
mexicoder CreditAttribution: mexicoder commentedHi @iphan for anyone else looking for the solution I'd complete the steps in #6 before starting to use direct db queries as in #19
Comment #29
jmuzz CreditAttribution: jmuzz commented@mexicoder How is it a problem with the module? I don't think people should be able to uninstall it when it is still providing fields. That could lead to unintentional data loss. There is a reason that Drupal handles fields this way and letting users skip the steps about removing the fields the module provides before removing the module itself is dangerous.
If you create a node type with a text field, for example, you are not able to deactivate or uninstall the text module until that field no longer exists. Can anybody provide an argument for why you should be able to?
Comment #30
duckzland CreditAttribution: duckzland commentedCrude way to FORCE uninstall using drush :
Comment #31
RAWDESK CreditAttribution: RAWDESK commented@jmuzz,
Here's my argument, since it seems to be only way to get around this field_name constraint issue :
https://www.drupal.org/project/field_collection/issues/2498567
Surprisingly this method worked on our staging environment, but not on production, resulting in
"field_collection is a required module and can't be disabled. Reason: Field type(s) in use - see Field list"
Anybody a clue how to get around this ?
Comment #32
RAWDESK CreditAttribution: RAWDESK commentedSo, this 6 year old hint worked for me :
https://www.drupal.org/project/field_collection/issues/1400478#comment-5...
- delete field_collection module from modules directory
- delete paragraphs module from modules directory (my case also had a field_name constraint with paragraph_item)
- add my field_name field to user entity (via UI)
- restore both removed modules
Eventually, disabling of field_collection, neither paragraphs module was required to fix
https://www.drupal.org/project/field_collection/issues/2498567
Comment #33
dalegrebey CreditAttribution: dalegrebey commentedRan Cron, Cleared Cache, No Field Collections -- Still can not disable, let alone uninstall this thing.
EDIT: #19 Worked for me.
Recommend against this module.
Comment #34
kscheirerComment #35
bcobin CreditAttribution: bcobin commented#30 worked a treat - thank you, @duckzland!
Comment #36
mrs_hatch CreditAttribution: mrs_hatch commented#19 for the win! Thank you so much.
Comment #37
ram4nd CreditAttribution: ram4nd as a volunteer commentedComment #38
markabur CreditAttribution: markabur commentedBack to "Active" as there's no patch here that needs work. Please see:
https://www.drupal.org/docs/develop/issues/fields-and-other-parts-of-an-...
Comment #39
ram4nd CreditAttribution: ram4nd as a volunteer commentedThere is no patch that needs work, but there are steps that need to be made into a patch.
Comment #40
thomaswalther CreditAttribution: thomaswalther commentedMy list of field collections is empty.
I run cron over 30 times.
I only have empty tables field_collection_item and field_collection_item_revision.
I still can not find, where the lost collections are.
So i can not delete the module.