Resolve the error that is raised on visit /admin/modules/uninstall:
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Core\Database\DatabaseExceptionWrapper</em>: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'unpublish_state' in 'where clause': SELECT 1 AS expression
FROM
{node_field_data} t
WHERE unpublish_state IS NOT NULL
LIMIT 1 OFFSET 0; Array
(
)
in <em class="placeholder">Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData()</em> (line <em class="placeholder">1805</em> of <em class="placeholder">core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php</em>). <pre class="backtrace">Drupal\Core\Database\Statement->execute(Array, Array) (Line: 631)
Drupal\Core\Database\Connection->query('SELECT 1 AS expression
FROM
{node_field_data} t
WHERE unpublish_state IS NOT NULL
LIMIT 1 OFFSET 0', Array, Array) (Line: 358)
Drupal\Core\Database\Driver\mysql\Connection->query('SELECT 1 AS expression
FROM
{node_field_data} t
WHERE unpublish_state IS NOT NULL
LIMIT 1 OFFSET 0', Array, Array) (Line: 510)
Drupal\Core\Database\Query\Select->execute() (Line: 1805)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData(Object, 1) (Line: 64)
Drupal\taxonomy_term_depth\DepthUninstallValidator->validate('scheduler_content_moderation_integration') (Line: 573)
Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array) (Line: 99)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall(Array) (Line: 121)
Drupal\system\Form\ModulesUninstallForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 519)
Drupal\Core\Form\FormBuilder->retrieveForm('system_modules_uninstall', Object) (Line: 276)
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: 115)
Drupal\shield\ShieldMiddleware->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)
Comments
Comment #2
vuilI update the issue summary.
Comment #3
vuilI see that there is not in DB -> {node_field_data} column {unpublish_state}.
I remove the module codebase and exclude the module from config, core.extensions.yml.
And, now it works well.
Comment #4
vuilThe issue is private case, and it is coming from not very well, DB lock, on installing. And there is a missing column `unpublish_state` in DB node_field_data table. The issue is fixed manually.
Comment #6
mstrelan commentedI had the same issue, where
publish_stateandunpublish_statewere missing and the status report showed "Mismatched entity and/or field definitions".I wrote this controller to fix it.
Comment #7
vuilSound good!
Could you integrate it as an
update_hook()function in the.modulefile?Thank you.
Great work!
Comment #8
darktek commented#6 worked for me very well.
In case someone doesn't know how to implement above's code, you can create an specific url path to run that code in your routing.yml file:
Comment #9
evgen commentedHere you can have a hook_update solution as well
https://www.drupal.org/project/scheduler_content_moderation_integration/...