10.3 makes terms moderatable so makes this module need to provide an update path

Created on 15 May 2024, about 2 months ago
Updated 12 July 2024, 1 day ago

Problem/Motivation

We need to provide an update path due to πŸ“Œ Enable Content Moderation integration for taxonomy terms Fixed

Steps to reproduce

Update to a site using taxonomy and this module to Drupal 10.3.x

Proposed resolution

When any entity type becomes moderatable due to code changes this module automatically adds fields to the entity type's schema. However this means an update function needs to run. This behaviour means that this module almost needs a permanent update function - which there is no system for. Ideally it would not work this way as it is very fragile.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

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

Merge Requests

Comments & Activities

  • Issue created by @alexpott
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    wonder if there is a better way to add the fields instead of scheduler_content_moderation_integration_entity_base_field_info()

  • πŸ‡¦πŸ‡ΊAustralia rsslwa

    Also running into this problem after an update core to 10.3.0, and running drush updb.

    Status report shows the "mismatched entity and/or field definitions error":

    "Taxonomy term

    - the Publish state field needs to be installed.
    - the Unpublish state field needs to be installed."

    Presumably by installed it means created.

  • πŸ‡ΊπŸ‡ΈUnited States drewcking

    I ran into the same entity update error after updating core to 10.3.0. I was able to fix it by just running the same "add_fields" function called by the 9001 update hook in the .install file:

    drush php:eval "_scheduler_content_moderation_integration_add_fields()"

  • πŸ‡ΊπŸ‡ΈUnited States Adrianm6254

    I tried #4 and it cleared the "mismatched entity and/or field definitions error"

    Thanks

  • πŸ‡ΊπŸ‡ΈUnited States joshuami Portland, OR

    Quick note for anyone needing to run that command on an Acquia environment, I found that you need to escape the parenthesis when running the command through acli, acli remote:drush [application].[environment] -- php:eval '_scheduler_content_moderation_integration_add_fields\(\)' worked where application is the project code and environment is the CD, dev, stage, or prod.

    It's a bit of a bummer to have to run it for every environment up the chain, but at least it unblocks the upgrade without persistent errors.

    We really need another release that adds scheduler_content_moderation_integration_update_9004() calling the same _scheduler_content_moderation_integration_add_fields() function. Or is that too messy and we should just rename the 9001 update and move it to the 9004 position. πŸ€”

    Any preferences from the maintainers? I'm happy to create the MR.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Never remove old updates unless you also use hook_update_last_removed(). You can empty them out. But in this instance I would just add a new update calling the same code.

  • Pipeline finished with Failed
    1 day ago
    Total: 133s
    #222008
  • Pipeline finished with Failed
    1 day ago
    #222010
  • Assigned to joshuami
  • Status changed to Needs review 1 day ago
  • πŸ‡ΊπŸ‡ΈUnited States joshuami Portland, OR

    Thanks, @alexpott. Added a merge request with the repeated function. Let me know if I got the naming convention correct. I assumed it should be "update_10301" as the first update required after Drupal 10.3, but maybe that should be "update_10300". 🀷

  • Issue was unassigned.
  • πŸ‡ΊπŸ‡ΈUnited States joshuami Portland, OR
Production build 0.69.0 2024