Document experiences for manual Group 2.x to 3.x update

Created on 23 May 2023, over 1 year ago
Updated 15 May 2024, 6 months ago

Problem/Motivation

In the issue https://www.drupal.org/project/group/issues/3318375#comment-14937415 πŸ“Œ Create official instructions for Group 2.x to 3.x migration Active , the process for updating from version 2 to version 3 is discussed. The recommended processes is to perform a content migration.

For small sites, this approach may be feasible, but when dealing with multisites, this operation can be very costly. To avoid the update of a module requiring this amount of time and resources, we are exploring other options that would avoid the need for a migration.

We have created a script that does the following:

  1. Renames the table "group_content__group_roles" to "group_relationship__group_roles" in the database.
  2. Update configuration values: The script utilizes the "config.factory" service to update the configuration values and parameters related to the machine names "group_content", "group_content_type" and "group.content_type" replacing them with "group_relationship" and "group_relationship_type" and "group.relationship_type".
  3. Rename configuration objects: Additionally, the script renames the configuration objects that were created based on the machine names.
  4. Clear caches: After the modifications are made, the script clears the caches to ensure the changes take effect.
  5. Export configuration.

At the moment, we have performed these steps, and although after carrying out these actions, the Groups module appears to be functioning correctly, the Drupal Status Report shows that the "Group Relationship" and "Group Relationship Type" entities need to be installed.

This is due to the schema not being updated. However, we are currently investigating how to solve this issue.

Is this an appropriate approach?

Thanks.

✨ Feature request
Status

Active

Version

3.3

Component

Documentation

Created by

πŸ‡ͺπŸ‡ΈSpain lpeidro Madrid

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

Comments & Activities

  • Issue created by @lpeidro
  • πŸ‡ͺπŸ‡ΈSpain lpeidro Madrid
  • πŸ‡ͺπŸ‡ΈSpain tunic Madrid

    Would be great to have the script posted so others can evaluate it.

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    Best approach would be to copy your website, remove all group related entities and uninstall group on the new copy, then update the code to 3.0.x on the new copy and finally reinstall Group and migrate your group related content from the old site to the new copy using the migrate module.

  • πŸ‡ͺπŸ‡ΈSpain tunic Madrid

    We are aware of what is said at πŸ“Œ Create official instructions for Group 2.x to 3.x migration Active . However, with all my respect, we think the best approach is having an upgrade path from major version to major version. That's what we are trying here and I would really appreaciate comments on this approach.

  • πŸ‡ͺπŸ‡ΈSpain lpeidro Madrid

    Hello @Tunic:

    This script is a proof of concept at maybe is not working in every project.
    It executes the action set in the description of this issue:

    1. Renames the table "group_content__group_roles" to "group_relationship__group_roles" in the database.
    2. Update configuration values: The script utilizes the "config.factory" service to update the configuration values and parameters related to the machine names "group_content", "group_content_type" and "group.content_type" replacing them with "group_relationship" and "group_relationship_type" and "group.relationship_type".
    3. Rename configuration objects: Additionally, the script renames the configuration objects that were created based on the machine names.

    It is a simple PHP class that I upload with the extensiΓ³n txt: Helper Class β†’

    Thanks.

  • πŸ‡¨πŸ‡±Chile mnico Santiago, Chile

    Hello! A few months ago I had to perform this update on a few projects. From that experience I have created a more generic module for this task and have just published it here β†’ . I hope it can help you, I don't know if it would work on all sites (I don't know if there are other configurations that are not being migrated properly).

    Instructions on how to use it are in the module's README.md file.

    Regards

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    @#5, #6, #7: The reason I did not provide an upgrade path is that I first had one but deemed it unsafe as there are simply too many things we cannot predict and we might leave people with a broken website.

    Installing a clean v3 on a website and then migrating your v2 data into said site is always safe because your entity schema, fields, etc. are already in place and you're making sure the incoming data is correct.

    You're free to use any module or code to try and upgrade directly, but please keep in mind that you might very well break your website in ways that might not immediately be apparent and therefore cause vague bug reports later on.

  • πŸ‡ͺπŸ‡ΈSpain tunic Madrid

    Thanks for your message on #8. Indeed, there are risks on using the upgrade path described here. If we do, we'll double check any bug found later to be sure it's from the module and not from the upgrade path used, we would like to have the issue queue clean of spurious errors.

    I would like to ask a question. Eventually, there will be Group 4 release. Do you think it is possible there will be an upgrade path without migrating or do you think any Group 2.x site will need that copy-and-migrate upgrade path sooner or later?

    #7, thanks for that link, we'll check it as well, and thanks for contributing it!

  • heddn Nicaragua

    I hope that an upgrade path from v2 to v4 will be possible.

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    Maybe by then core has better support for this type of thing, but for now it's really hard to rename an entity type. I had an upgrade path that took care of the definitions, field definitions and views and it still broke in various ways because of how hard it is to do this properly.

    The good news is that v4 is probably going to take years to land, so you'll have plenty of time to enjoy the v2/v3 API and if the time does come to move from v2 to v4, we'll hopefully have some (sponsored?) documentation and tools to help you migrate by then.

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

    any update on the "Group Relationship" and "Group Relationship Type" entities need to be installed issue?

    I'm working on our site's D9 to D10 upgrade and this error message is one of our lingering outliers.

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

    I know this is a composer question, but I just finally got to Group 2.2 after nearly since the first effort. In reading about what it takes to go from 2.x to 3.x, I'm terrified.

    Currently, my composer settings want to automatically upgrade me from Group 2.2.0 to 3.2.0. How can I change my composer settings to not allow any automatic upgrade to 3.x?

    I know this probably isn't the place for this, but I expect everybody here knows how to do it.

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    You can stay on 2.2 for quite a long time, so don't worry too much about it. When the time is due to migrate to v3, which is when v4 comes out, I hope to have found a sponsor to help us write the documentation and perhaps helper module to assist people in making the upgrade.

  • πŸ‡©πŸ‡ͺGermany geek-merlin Freiburg, Germany

    Another story to share:
    - Have a site with huge sitebuilding, but no content (it's not yet in production)

    A drush site-install --existing-config fails because not only DB tables changed, but also a lot of config names.

    What i did and encountered:
    - Created a bash script that changes all names in config/sync directory (attached)
    - After running that on my config, i tried drush site-install --existing-config
    - That had some issues
    - Of course, name changes like group_content_type_ad6738256f30d => group_relationship_type_ad6738256f30d broke the import, because "32 character limit"
    - Also i had errors like "The content relationship plugin X could not be found". I cross-checked, but no idea why.
    - In the end, i took the name-changed config, and deleted all content_relationship_type config. It only took 10 minutes to recreate them.

  • πŸ‡ΊπŸ‡¦Ukraine HitchShock Ukraine

    A solution #6 is pretty good for me.
    I just updated it a bit:
    - it's better to use regex patterns to search and replace values
    - sometimes we need also to update config keys (not only values)
    - it's not required to update IDs of the Relationship Types. We can keep them to prevent possible errors with IDs mentioned in #15

    And of course, you need to update your custom code:
    - group_content -> group_relationship
    - group_content_type -> group_relationship_type

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    Make sure to keep an eye on πŸ“Œ Try to provide an upgrade path from 2.x.x to 3.x.x Active

Production build 0.71.5 2024