I am unable to uninstall this module after saving some nodes with a custom body class.
The following screenshot shows the error that appears when the module is uninstalled via Drush.

errror

CommentFileSizeAuthor
custom-body-class-error.png302.45 KBsarthak drupal
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sarthak drupal created an issue. See original summary.

Gixxernutter’s picture

I'm having the same issue, any fix for uninstalling this module ?

---------------------------------
The website encountered an unexpected error. Please try again later.Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '113-415-1-0-cy' for key 'PRIMARY': INSERT INTO {field_deleted_revision_79e5b08d98} (bundle, entity_id, revision_id, langcode, body_class_value, deleted, delta) SELECT base_table.type AS bundle, entity_table.nid AS entity_id, entity_table.vid AS revision_id, entity_table.langcode AS langcode, entity_table.body_class AS body_class_value, :deleted AS deleted, :delta AS delta
FROM
{node_field_data} entity_table
INNER JOIN {node_field_data} base_table ON entity_table.nid = base_table.nid
WHERE entity_table.body_class IS NOT NULL FOR UPDATE; Array
(
[:deleted] => 1
[:delta] => 0
)
in Drupal\Core\Database\Connection->handleQueryException() (line 689 of core/lib/Drupal/Core/Database/Connection.php).

Drupal\Core\Database\Statement->execute(Array, Array) (Line: 631)
Drupal\Core\Database\Connection->query('INSERT INTO {field_deleted_revision_79e5b08d98} (bundle, entity_id, revision_id, langcode, body_class_value, deleted, delta) SELECT base_table.type AS bundle, entity_table.nid AS entity_id, entity_table.vid AS revision_id, entity_table.langcode AS langcode, entity_table.body_class AS body_class_value, :deleted AS deleted, :delta AS delta
FROM
{node_field_data} entity_table
INNER JOIN {node_field_data} base_table ON entity_table.nid = base_table.nid
WHERE entity_table.body_class IS NOT NULL FOR UPDATE', Array, Array) (Line: 358)
Drupal\Core\Database\Driver\mysql\Connection->query('INSERT INTO {field_deleted_revision_79e5b08d98} (bundle, entity_id, revision_id, langcode, body_class_value, deleted, delta) SELECT base_table.type AS bundle, entity_table.nid AS entity_id, entity_table.vid AS revision_id, entity_table.langcode AS langcode, entity_table.body_class AS body_class_value, :deleted AS deleted, :delta AS delta
FROM
{node_field_data} entity_table
INNER JOIN {node_field_data} base_table ON entity_table.nid = base_table.nid
WHERE entity_table.body_class IS NOT NULL FOR UPDATE', Array, Array) (Line: 32)
Drupal\Core\Database\Driver\mysql\Insert->execute() (Line: 743)
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionDelete(Object) (Line: 1585)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->Drupal\Core\Entity\Sql\{closure}() (Line: 1603)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException(Object) (Line: 1588)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->onFieldStorageDefinitionDelete(Object) (Line: 133)
Drupal\Core\Field\FieldStorageDefinitionListener->onFieldStorageDefinitionDelete(Object) (Line: 272)
Drupal\Core\Entity\EntityDefinitionUpdateManager->uninstallFieldStorageDefinition(Object) (Line: 440)
Drupal\Core\Extension\ModuleInstaller->uninstall(Array, 1) (Line: 91)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array) (Line: 171)
Drupal\system\Form\ModulesUninstallConfirmForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 590)
Drupal\Core\Form\FormBuilder->processForm('system_modules_uninstall_confirm_form', Array, Object) (Line: 319)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

---------------------------------

markdc’s picture

My trouble uninstalling this module was slightly different.

Drush alerted me custom_body_class: There is data for the field specific_node_class on entity type Content.

It wasn't enough to remove the class names that I had entered in the text field on specific nodes.

The checkbox If checked, add name of node type as class to body tag saves a value to the database: 0 if checked, 1 if not checked. Every other node that hasn't been saved since installing the module has no value (is null) in the database. So even if you don't use this feature, it leaves data in the database on every node save. This prevented uninstalling for me.

The only way I could remove all values and uninstall the module was to edit the database. Here is the MySQL query that worked for me:

UPDATE node_field_data
SET specific_node_class = NULL
WHERE specific_node_class is not null;

As soon as I did that, I could uninstall the module.

avpaderno’s picture

Title: Custom body Class Uninstalltion problem. » The module causes errors when it's uninstalled and there are nodes using a custom body class
Issue summary: View changes
Issue tags: -uninstall problems

AstonVictor made their first commit to this issue’s fork.

astonvictor’s picture

Status: Needs work » Needs review

Created a new MR to resolve the issue.