2

As an experiment I've merged core from 8.3.x branch to try out workflow. After successfully assigning 'editorial workflow' to articles and pages, I cannot access the pages or articles anymore neither to read them as a guest or to edit them as an admin.

Visiting /admin/reports/status, I see this error:

Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.

  • Comment

    The Publishing status field needs to be updated.

My expectation is that the existing entities needs their workflow states to be set, but I expected the workflow module to automatically assign 'published' state to published articles. How can I fix that?

I was wrong about that this was only happening with existing articles. Another article after been created as well started behaving the same.
This was the error from log:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content_moderation_state_field_data.workflow' in 'where clause': SELECT base_table.revision_id AS revision_id, base_table.id AS id FROM {content_moderation_state} base_table INNER JOIN {content_moderation_state_field_data} content_moderation_state_field_data ON content_moderation_state_field_data.id = base_table.id WHERE (content_moderation_state_field_data.content_entity_type_id IN (:db_condition_placeholder_0)) AND (content_moderation_state_field_data.content_entity_id IN (:db_condition_placeholder_1)) AND (content_moderation_state_field_data.workflow IN (:db_condition_placeholder_2)) AND (content_moderation_state_field_data.default_langcode IN (:db_condition_placeholder_3)); Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => 8 [:db_condition_placeholder_2] => editorial [:db_condition_placeholder_3] => 1 ) in Drupal\Core\Entity\EntityStorageBase->loadByProperties() (line 503 of \core\lib\Drupal\Core\Entity\EntityStorageBase.php)." Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE…

0

Missing column of the contrib module indicates the corruption of the database. In your case workflow field is missing in content_moderation_state_field_data.

If this error start happening after upgrade, try running Database Update (either by going to /update.php or running drush updb command).

There is a Unofficial content_moderation 8.2.x to 8.3.0 upgrade path which can also help. It has relevant patches for content_moderation module with update hooks, which will migrate the tables accordingly.

Otherwise you'll have to reinstall the module, so its tables are re-created from scratch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.