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.
Hi,
I have installed the module but if I try to uninstall it immediately it's not possible. The message is : There are origname field data for the type of file entity.
Can you explain to me how I can unistall it ?
Thank
Comments
Comment #2
stevensf CreditAttribution: stevensf commentedComment #3
Deciphered CreditAttribution: Deciphered at Realityloop commentedI'm escalating this issue to Major as it's a pretty big issue.
It's also quite a complicated issue.
Essentially, File (Field) Paths is, both in the past and currently, adding a new field to the File entity;
origname
. This field contains what the original name of the file was at the point it was uploaded (or when the module was installed), allowing modified files to be reverted back to their original name at a later stage, and various other usages.Drupal 8 allows for this behaviour, but what it doesn't allow for is the ability to purge this data, therefore making it impossible to uninstall a module that has taken this path without implementing a custom storage solution... unless you are the Field module, in which case you get an exception from this rule.
It's likely I will either have to implement a workaround, or re-architect this particular piece of functionality so that this issue can be resolved, but both will take some time and though to ensure that the correct solution is implemented.
Comment #4
Dom. CreditAttribution: Dom. as a volunteer and at ACINO commentedUpdating to critical since their no way to workaround except direct SQL.
Run this : UPDATE file_managed SET origname = null
to empty the whole column before you can then delete the module.
Comment #5
Macronomicus CreditAttribution: Macronomicus commentedIve a slightly different error along these same lines, for me the module didn't install properly and then wasn't able to uninstall.
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'origname' in 'where clause': SELECT 1 AS expression FROM {file_managed} t WHERE ( (origname IS NOT NULL ) ) LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData() (line 1658 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
So in this case the solution is the following mysql for the missing column...
mysql>alter table file_managed add column origname varchar (20);
Then i was able to uninstall, I still had to manually delete the origname column as uninstall didnt remove that, everything is back to normal now, best of luck on the planned fix :)
Comment #6
frobSounds like the best solution would be to move this data over to its own table.
Has a core issue been opened on this? It sounds like a core issue.
Comment #7
MartinMa CreditAttribution: MartinMa as a volunteer commentedJust had this problem too. Thanks to #4 I could remove it! It seem, that another problem removing file entity module was also solved for me :-)
Comment #8
SKAUGHTalter table file_managed add column origname varchar (20);
worked...
this issue needs to be addressed. still critical.
Comment #9
SKAUGHTremoving assigned person.
Comment #10
Rewted CreditAttribution: Rewted commentedIssue still remains. Cannot uninstall even though it wasn't even used.
Comment #11
rooby CreditAttribution: rooby commentedNot critical because it doesn't break anything or render the site unusable and there is a work around.
Comment #12
sassafrass CreditAttribution: sassafrass as a volunteer commentedHaving this issue too. #4 is a temporary fix, but it worked for me.
Comment #13
joelpittet@Deciphered Could you just put in a
hook_uninstall
to purge the values in that column and delete the field?https://www.drupal.org/docs/8/api/entity-api/defining-and-using-content-...
Comment #14
joelpittetNM, I see the problem is tied to this core issue: #2282119: Make the Entity Field API handle field purging
Comment #15
jonathanshawAccording to #2905944: Uninstall modules which define base fields you can uninstall a module that provides a base field on a 3rd party entity, if you first set it to NULL.
For an entity_test_extra module providing a _test_base_field on an entity_test entity, this works:
So perhaps this module could set it's base field to NULL in hook_uninstall
Comment #16
leopinzon CreditAttribution: leopinzon as a volunteer commentedI had the same issue, even after just installed but never used it. Anyway thanks to comment #4 I was able to uninstall it.
Comment #17
jonathanshaw#2282119: Make the Entity Field API handle field purging will enable base field deletion in core.
Comment #18
SKAUGHTalthough, won't help anyone running less than 8.5 once it lands.. this issue against module would still stand.
Comment #19
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedI came across this thread when hitting the same problem for a module I am developing.
@jonathanshaw I don't think #15 works. In my testing hook_uninstall did not even get called if the checks failed.
I did manage to create a function like this
Which can then be called from
drush eval
.Comment #20
ChuChuNaKu CreditAttribution: ChuChuNaKu as a volunteer and at Acquia commented#4 worked for me as a temporary workaround too. Here are the steps I took using drush