When I try to run the lightning update that installs wbm2cm, I get the error:

"The following reasons prevent the modules from being uninstalled: There is data for the field moderation_state on entity type Content"

I also get the error when I uninstall workbench_moderation using "drush pmu workbench_moderation. I have patched workbench moderation's latest dev release as described in https://www.drupal.org/project/workbench_moderation/issues/2627012 #47.

Here is the error

>drupal update:lightning since=2.2.3 --no-interaction
Executing all updates since version since=2.2.3.
Lightning Media 2.1.8
Media Image 2.1.8
        Lightning Workflow 2.1.8
Installing wbm2cm.
Saving existing moderation states...
Removing moderation states. This is necessary in order to uninstall Workbench Moderation.
Installing Content Moderation...


  [Drupal\Core\Extension\ModuleUninstallValidatorException]
  The following reasons prevent the modules from being uninstalled: There is data for the field moderation_state on entity type Content, <a href="/admin/modules/uninstall/workbench_moder
  ation">Remove field values</a>: moderation_state on entity type Content.


update:lightning [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env [ENV]] [--root [ROOT]] [--debug] [--learning] [-c|--generate-chain] [-i|--generate-inline] [-d|--generate-doc] [-t|--target [TARGET]] [-l|--uri URI] [-y|--yes] [--] <command> <since>


Comments

captaindav created an issue. See original summary.

balsama’s picture

Several users have reported being unable to uninstall Workbench Moderation. @brathbone ended up tracing his problem to a seemingly unrelated module - although I can't remember what it was now. Maybe try to ping him in the #lightning Slack channel when he comes online.

I also found this tangentially related issue #2282119: Make the Entity Field API handle field purging. It might help if you apply the patch from that issue.

ARUN AK’s picture

Priority: Normal » Critical

Same here. @captaindav, you got this resolved?

Because of this content_moderation and workbench_moderation conflict I'm facing other issues too:

phenaproxima’s picture

Priority: Critical » Normal

Please do not use the Critical priority for anything except data loss and security issues.

adamschan’s picture

Got the exact same issue after applying #34 from https://www.drupal.org/project/workbench_moderation/issues/2627012, still no clue.

ARUN AK’s picture

Status: Active » Needs review

The patch mentioned here helped me to uninstall workbench module. I followed:

  1. Applied the patch mentioned in comment #34 here.
  2. Cleared Drupal Cache.
  3. Deleted filed data through this page /admin/modules/uninstall/workbench_moderation
  4. Cleared Drupal Cache again
  5. Ran cron jobs

After deleted field data I was able to uninstall workbench_moderation module.

ellioseven’s picture

I am following the update instructions here: https://github.com/acquia/lightning/releases/tag/2.2.4

The Drupal Console instructions don't seem to work, so I have to run the updates manually.

When I run

docroot$ drush wbm2cm-migrate



I get the following error.

app@b1166670def8:~/src/docroot$ drush wbm2cm-migrate
Saving existing moderation states to temporary tables...
Processed 8947 content items.
Removing Workbench Moderation data...
Processed 8947 content items.
Installing Content Moderation...
Drupal\Core\Extension\ModuleUninstallValidatorException: The following reasons prevent the modules from being uninstalled: Remove field values: moderation_state on entity type Content., There is data for the field moderation_state on entity
type Content in /home/app/src/docroot/core/lib/Drupal/Core/Extension/ModuleInstaller.php:365
Stack trace:
#0 /home/app/src/docroot/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(91): Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#1 /home/app/src/docroot/modules/contrib/wbm2cm/wbm2cm.drush.inc(29): Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
#2 /home/app/src/vendor/drush/drush/includes/command.inc(422): drush_wbm2cm_migrate()
#3 /home/app/src/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#4 /home/app/src/vendor/drush/drush/includes/command.inc(199): drush_command()
#5 /home/app/src/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#6 /home/app/src/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#7 /home/app/src/vendor/drush/drush/drush.php(12): drush_main()
#8 {main}



I have tried the patch mentioned in #6. Although it did allow me to uninstall module manually, however when running the migration I still hit the same issue.


Has anyone else managed to fix this?

Tomotsugu Kaneko’s picture

Hi, @ellioseven I had same error as yours.
In my case fix with:
1. goto `/admin/content/scheduled_update`
2. remove all schedules.
3. run `drush wbm2cm-migrate` agin.

florianmuellerCH’s picture

Status: Needs review » Active

Having the same issue here after updating to 2.26. We have the field "moderation_state" on some content types to set the moderation state of a content (page or so). This field should be migrated to content_moderation in my opinion, however it's not doing this:

drush wbm2cm-migrate
Saving existing moderation states to temporary tables...
Processed 4327 content items.
 Processed 15622 paragraph entities.
Removing Workbench Moderation data...
Processed 4327 content items.
 Processed 15622 paragraph entities.
Installing Content Moderation...
Drupal\Core\Extension\ModuleUninstallValidatorException: The following reasons prevent the modules from being       [error]
uninstalled: There is data for the field moderation_state on entity type Content. in
/var/www/drupal/public_html/docroot/core/lib/Drupal/Core/Extension/ModuleInstaller.php:365
Stack trace:
#0 /var/www/drupal/public_html/docroot/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(91):
Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#1 /var/www/drupal/public_html/docroot/modules/contrib/wbm2cm/wbm2cm.drush.inc(29):
Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
#2 /opt/drush/8/vendor/drush/drush/includes/command.inc(422): drush_wbm2cm_migrate()
#3 /opt/drush/8/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#4 /opt/drush/8/vendor/drush/drush/includes/command.inc(199): drush_command()
#5 /opt/drush/8/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#6 /opt/drush/8/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#7 /opt/drush/8/vendor/drush/drush/drush.php(12): drush_main()
#8 {main}
adamschan’s picture

phenaproxima’s picture

Project: Lightning » Lightning Workflow
Version: 8.x-2.26 » 8.x-2.x-dev
Component: Workflow » Code
Wim Leers’s picture

ramalingam07’s picture

I am getting below the error while run `drush wbm2cm-restore` - Drupal 8.5.15

`in Drupal\Core\Entity\Sql\SqlContentEntityStorage->saveRevision() (line 1101 of
/var/www/cgicom/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Entity\EntityStorageException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'revision_default' in 'field list': INSERT INTO [error]
{content_moderation_state_revision} (id, langcode, revision_default) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2);
Array
(
[:db_insert_placeholder_0] => 53
[:db_insert_placeholder_1] => en
[:db_insert_placeholder_2] => 1
)`

Anyone can help ?