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.
When I tried to uninstall the module, I get this fun error:
In SqlContentEntityStorage.php line 1490:
Exception thrown while performing a schema update. SQLSTATE[42S22]: Column not found: 1054 Unknown column 'entity_table.id' in 'field list': INSERT INTO
{field_deleted_data_38d3088921} (bundle, entity_id, revision_id, langcode, created_value, deleted, delta) SELECT entity_table.contact_form AS bundle, ent
ity_table.id AS entity_id, entity_table.id AS revision_id, entity_table.langcode AS langcode, entity_table.created AS created_value, :deleted AS deleted,
:delta AS delta
FROM
{contact_message} entity_table
WHERE entity_table.created IS NOT NULL FOR UPDATE; Array
(
[:deleted] => 1
[:delta] => 0
)
In Connection.php line 686:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'entity_table.id' in 'field list': INSERT INTO {field_deleted_data_38d3088921} (bundle, entity_id,
revision_id, langcode, created_value, deleted, delta) SELECT entity_table.contact_form AS bundle, entity_table.id AS entity_id, entity_table.id AS revis
ion_id, entity_table.langcode AS langcode, entity_table.created AS created_value, :deleted AS deleted, :delta AS delta
FROM
{contact_message} entity_table
WHERE entity_table.created IS NOT NULL FOR UPDATE; Array
(
[:deleted] => 1
[:delta] => 0
)
In Statement.php line 59:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'entity_table.id' in 'field list'
After some trial and error, I found if I truncate the contact_message table, I can then ununstall this module. Maybe something need to go in an uninstall hook to do as such?
Comment | File | Size | Author |
---|---|---|---|
#5 | sql-error-when-uninstalling-3028830-5.patch | 650 bytes | jacktonkin |
|
Comments
Comment #2
mobius_time CreditAttribution: mobius_time commentedI also receive an error when uninstalling the 8.x-1.0 version of this module:
And then I get an error in the admin interface when I click on the Extend > Uninstall tab.
Comment #3
jacktonkin CreditAttribution: jacktonkin at ISSUP commentedI was getting the same errors as #2 above, and solved it by putting the following in an update function in a custom module:
This adds the missing id column and allows the module to uninstall cleanly.
Comment #4
jacktonkin CreditAttribution: jacktonkin at ISSUP commentedOn closer inspection the code in #3 was only required to recover from the failed uninstall. Simply truncating the
contact_message
andcontact_message__${field_name}
tables was enough to perform the uninstall.Comment #5
jacktonkin CreditAttribution: jacktonkin at ISSUP commentedThe attached patch implements hook_uninstall to truncate all of the entity tables prior to removal.
Note that I haven't tested against the current release as I only have 8.x-1.0 installed.
Comment #6
afagioliThis was also breaking the site at send of personal contact form.
Here's how I fixed this:
* make a backup
* composer remove drupal/contact_storage
* drush --uri=https://site cr
* composer require drupal/contact_storage
* navigate a bit from admin/modules and admin/modules/uninstall back and forth (silly, eh?)
* uninstall module, now working
Hope this helps
Comment #7
urix CreditAttribution: urix commentedHello.
I'm having the same error upon uninstallation of this module
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base_table.id' in 'field list': SELECT base_table.id AS id, base_table.id AS base_table_id FROM {contact_message} base_table LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\EntityStorageBase->hasData() (line 588 of /home/c/co43587/public_html/core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Truncating tables contact_message and contact_message_{field_name} was not enough.
I see that there was no 'id' column in 'contact_message' table.
So, after manually adding this column, uninstallation was successful.
Comment #8
SamTheManThe black magic in #6 solved it for me. Thanks @afagioli!
Comment #9
yi_jiang CreditAttribution: yi_jiang as a volunteer commentedhave the same issue #7, its a pain.
Comment #10
hamadknows CreditAttribution: hamadknows as a volunteer commented+1 for #6, it works like a charm for me!
Thanks
Comment #11
filsterjisah CreditAttribution: filsterjisah at Anvil commentedSame issue.
Since the issue is about uninstalling data backup (of contact_form entities) should not be needed.
The update hook I used to cleanly uninstall:
Comment #12
eelkeblokThis and #3039906: Properly uninstall entity types are duplicates. This issue is a little older, but I think the direction the solution in the other ticket is taking is a bit more appropriate instead of having to "manually" truncate database tables.