Cannot uninstall module due to missing publish_state and unpublish_state fields

Created on 12 October 2021, about 3 years ago
Updated 31 July 2024, 5 months ago

Problem/Motivation

I'm having the same issue described here #3133832: Error uninstalling the module , and I can't uninstall the module. When I try to uninstall via drush:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'publish_state' in 'where clause': SELECT 1 AS "expression"
FROM
"node_field_data" "t"
WHERE "publish_state" IS NOT NULL
LIMIT 1 OFFSET 0; Array
(
)

I see the other issue is marked as "fixed," but I'm not sure why. It looks like the resolution was to write a controller, but I shouldn't have to write a custom module to uninstall this module. I can't re-open the other, so I'm creating a new ticket here.

Is the solution to add an update_hook as noted in the comments ?

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States capysara

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • For those landing here looking for an expedient solution, you can run:

    drush ev "_scheduler_content_moderation_integration_add_fields()"
    

    And then uninstall the module via the admin UI.

  • 🇮🇳India newswatch Delhi/Bangalore

    I am unable to uninstall this module.

    The error message:

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'publish_state' in 'where clause': SELECT 1 AS "expression" FROM "media_field_data" "t" WHERE "publish_state" IS NOT NULL LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData() (line 1794 of /home/sitename/public_html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

  • 🇺🇸United States smustgrave

    Fixes will need to be against 3.0.x

  • 🇺🇸United States loopy1492

    We were getting the following:

    Mismatched entity and/or field definitions
    The following changes were detected in the entity type and field definitions.
    Taxonomy term
    The Publish state field needs to be installed.
    The Unpublish state field needs to be installed.

    We attempted to remediate by simply uninstalling and reinstalling the module and exporting the config, but we received the error in the OP. Instead, we had to do the following:

    drush php:eval "require_once 'modules/contrib/scheduler_content_moderation_integration/scheduler_content_moderation_integration.install';"
    
    drush php:eval "require_once 'modules/contrib/scheduler_content_moderation_integration/scheduler_content_moderation_integration.install'; scheduler_content_moderation_integration_update_9001();"
    
    drush php:eval "require_once 'modules/contrib/scheduler_content_moderation_integration/scheduler_content_moderation_integration.install'; scheduler_content_moderation_integration_update_9002();"
    
    drush php:eval "require_once 'modules/contrib/scheduler_content_moderation_integration/scheduler_content_moderation_integration.install'; scheduler_content_moderation_integration_update_9003();"
    
    drush cex -y
    

    Then commit the new configuration.

Production build 0.71.5 2024