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

Created on 15 May 2024, 6 months ago
Updated 31 August 2024, 3 months 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

Fixed

Version

3.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
    4 months ago
    Total: 133s
    #222008
  • Pipeline finished with Failed
    4 months ago
    #222010
  • Assigned to joshuami
  • Status changed to Needs review 4 months 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
  • πŸ‡©πŸ‡ͺGermany sunlix Wesel

    I can confirm that this update works as intended. The error message in status report belonging to entity and field definition update disappears after that update-hook.

    From my point of view this could be RTBC. A new release would be very helpful. :)

  • Status changed to RTBC 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States RichardDavies Portland, Oregon

    I can also confirm that the MR removed the error message for our site.

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

    This worked for us as well.

  • πŸ‡ΊπŸ‡ΈUnited States neclimdul Houston, TX

    Looks like this worked for us as well.

  • πŸ‡ΊπŸ‡ΈUnited States neclimdul Houston, TX

    I realized this only works if you've already updated to 10.3. If this was released and you applied it to a 10.2 site prior to upgrading you'd be in the same position. Not sure how to address that though...

  • Status changed to Needs work 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States joshuami Portland, OR

    I'm setting this back to needs work based on @neclimdul's comment.

    Ideally, a maintainer would want to apply the additional update to a new release that required 10.3 or greater. Given the module is currently at 2.0.0-beta2, I'm not completely sure what that release should be.

    @smustgrave, I noticed you have a 3.0.x branch for Drupal 11 compatibility. Would it make sense to create a beta release for that branch with a requirement for "drupal/core": "^10.3 || ^11", that contains the new update in this MR?

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

    Sorry for the delay but don't get much time for this module.

    But yes the 3.0.x never got a release so I'd be open to a 10.3 requirement there.

  • πŸ‡ͺπŸ‡ΈSpain selvira Seville, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Hi there, I got the same issue, I checked the solution provided by and it worked perfectly, either adding it in a new release or in 2.x should be done asap.

    Best regards.

  • πŸ‡ͺπŸ‡ΈSpain selvira Seville, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Dear all,
    I am adding a patch as a temporary solution.

    Best regards.

  • Status changed to Fixed 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Patches shouldn't be added as work should be in the MR please. if you need a patch can download from gitlab.

    Made 3.0.x require 10.3 and pushed the fix there since this was previous RTBC.

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

    FYI did a 3.0.0 release just now

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024