Problem/Motivation
Because of the mismatch between entity type machine names in v2 and v3, there is no upgrade path. Let's see if there isn't a way to write an update hook that takes care of this after all.
Steps to reproduce
Proposed resolution
From a Slack conversation with @catch:
- Rename group_content__field_foo to group_relationship__field_foo , the column names seem unchanged
- Somehow get this info into the entity/field definition update manager, even if we bypassed it in step 1
- Update field storage entities that reflect the above, perhaps through config API rather than Entity API
- Loop over all ER fields and update their definition and tables to no longer point to group_content
- Loop over all Views?
We already renamed the base and data tables to be consistent across group 2 and 3. Although I don't think I ever updated the Views to account for the new table names.
Remaining tasks
- Create a fixture coming from v2 of a site with at least one custom field, one custom field with a really long machine name, a View, an entity reference to a membership.
- Write all of the necessary update hooks.
User interface changes
API changes
Could finally sunset Group 2 \o/
Data model changes
Issue fork group-3440222
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
kristiaanvandeneyndeAdded a fixture, but could not get a garbled DB table name in it (longer than 48 characters becomes a hash), sadly enough. We'll have to make sure we call DefaultTableMapping::generateFieldTableName() with the old and new field storage to know which tables to rename to what.
Comment #4
kristiaanvandeneyndeThe MR only works in the browser when using the fix from #3441222: Allow update.php to load when entity type info needs to be updated.
Still need to update all group content types to group relationship types now.
Comment #5
kristiaanvandeneyndeStarting to look really nice, think I just need to get the field instances correct now.
Comment #6
kristiaanvandeneyndeLooks like it's actually working :o
It was failing on update.php because I forgot to drop tall tables before retrying. Gonna expand the tests now and see if I can make sure they work well too. Had some failures before.
Comment #7
kristiaanvandeneyndeEntityFieldManager::getFieldMap() still doesn't know about the field_config entities we moved, so that needs fixing.
Comment #8
connbi commentedIs there any plan on when the upgrade path from 2 to 3 will be completed? Very much looking forward to this feat
Comment #9
kristiaanvandeneyndeWaiting for 10.3 to come out with the fix to the update.php page, which is now RTBC here and should get committed next week. #3441222: Allow update.php to load when entity type info needs to be updated
Having said that, still need confirmation from some people who have tried this on their sites.
Comment #10
shelaneI would love to test this, but I want to make sure I'm doing to right path for testing. Let me know if I'm on track here.
Comment #11
kristiaanvandeneyndeRe #10: Yup that's exactly it. You make sure your 2.x.x is on the latest version and then change your code to the latest 3.3.x with this MR applied. Also make sure you check out the 3.x.x-compatible code for any Group related modules you have installed.
So far I've heard that this breaks with the Subgroup (Graph) module because they changed their plugin machine names between v2 and v3 and so that module would also need an upgrade path. Any other module such as Subgroup, Group Sites, etc. should theoretically be fine.
Comment #12
dbielke1986 commentedI would also be interested in testing this upgrade path.
We will do some tests as soon as Drupal 10.3 is released, and you give us the go to test.
Comment #13
kristiaanvandeneyndeIt's ready to test now. You don't need D10.3 if you use drush updb
Comment #14
shelaneThe patch does not apply against 3.2.2 (Could not apply patch! Skipping. The error was: Cannot apply patch ./patches/group.patch) and I'm unable to update to the dev of 3.3.x because of this:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- drupal/group dev-3.3.x requires drupal/core ^10.3 -> found drupal/core[10.3.0-beta1, 10.3.x-dev, 10.4.x-dev] but these were not loaded, likely because it conflicts with another require.
Comment #15
kristiaanvandeneyndeCould you try checking out the latest Group 3.3.x using git? If you use composer you'll have to specify the -W flag to also download all dependencies, including Drupal 10.3-rc1
Comment #16
gorkagr commentedHi!
As mentioned in slack.
Performed:
then a fiend & replace in all my code from group_content to group_relationship
all seems good.
I have only experienced 2 issues I have noticed today.
There was a pathauto alias that was broken: pathauto.pattern.group_content.yml
and also a core.entity_view_mode.group_content.token.yml
But these config files might have been created by me or anyone from the project
Then, i have no clue if it is just my DB, but when running cron() i have this log message:
but there is no trace of such string in my database, so i have no clue from where the error is coming from
Comment #17
gorkagr commentedI am not sure if it is on mine or if i did smth wrong (as i messed with my localhost a bit)but it seems i have some DB tables named after group_content (nstead of group_relationship) in config_export table
and also a few entries in key_value with group_content_type keyword
I will continue testing this
So it seems in the database, in the table key_value, i have:
AND
both with the same uuid, matching one group.relationship_type.-group_membership.yml file
and inside other blobs in key_value table such as :
entity.definitions.installed group_relationship.entity_type(not sure if relevant or not)
( I have all the entries duplicated, from old to new)
Comment #18
joachim commentedI can confirm #17.
I ran the test src/Functional/Update/Group2to3UpdateTest.php --filter=testEntityReferenceFields (just because it seemed the simplest and quickest), with the patch from #3211330: add a way to manually use the test site from a Functional test applied to core, so that the DB is preserved after the test.
I found these rows in the {key_value} table of the test DB after the test:
These values are used by Drupal\Core\Config\Entity\Query\QueryFactory::getConfigKeyStore() for fast lookups of config entities.
Comment #19
kristiaanvandeneyndeThis issue has been open for almost half a year and the little feedback we got has been addressed. Going to commit.
Comment #21
kristiaanvandeneyndeComment #22
kristiaanvandeneyndeComment #23
heddnI never ran group 2.x and when updating to the latest 3.3.x today, I ran into issues with the three v2 => v3 upgrade hooks. The first one,
group_update_10300doesn't not seem to account for the possibility that nogroup_relationshipconfig entities would exist (if no v2 was ever installed). Should we roll a new issue for this or call for a quick revert on this with more work to make this handle the non-upgrade path?Comment #24
realityloop commentedI've just hit the same errors as @heddn
Comment #26
kristiaanvandeneyndeJust pushed a simple fix, please verify.
Comment #27
heddnFixes the issue. Thank you
Comment #28
kristiaanvandeneyndeThanks for verifying!