Should upgrading a site from Group 1.0 to 2.0alpha4 be working at this point? If yes, then I hit a snag...
Problem/Motivation
Unable to upgrade a very simple Group site from 1.4 to 2.0alpha 4. Error occurs when running database updates.
$ drush updb
-------- ----------- --------------- -----------------------------------------------------------------------------------
Module Update ID Type Description
-------- ----------- --------------- -----------------------------------------------------------------------------------
group 9201 hook_update_n 9201 - Add plugin_id and group_type fields and update indexes for group content.
group 9202 hook_update_n 9202 - Remove the 'bypass group access' permission from all roles.
group 9203 hook_update_n 9203 - Convert group roles with the 'administer group' permission to admin roles.
group 9204 hook_update_n 9204 - Convert synchronized group roles to new scope and target_role structure.
group 9205 hook_update_n 9205 - Convert default group roles to new scope and target_role structure.
group 9206 hook_update_n 9206 - Convert user created group roles to new scope and target_role structure.
group 9207 hook_update_n 9207 - Remove label and description from group content types.
-------- ----------- --------------- -----------------------------------------------------------------------------------
Do you wish to run the specified pending updates? (yes/no) [yes]:
>
> [notice] Update started: group_update_9201
> [error] Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'plugin_id' cannot be null: INSERT INTO "tmp_8914b4group_content_field_data" ("id", "type", "langcode", "uid", "gid", "entity_id", "label", "created", "changed", "default_langcode", "plugin_id", "group_type") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11); Array
> (
> [:db_insert_placeholder_0] => 1
> [:db_insert_placeholder_1] => term-group_membership
> [:db_insert_placeholder_2] => en
> [:db_insert_placeholder_3] => 1
> [:db_insert_placeholder_4] => 1
> [:db_insert_placeholder_5] => 1
> [:db_insert_placeholder_6] => admin
> [:db_insert_placeholder_7] => 1654189793
> [:db_insert_placeholder_8] => 1654189793
> [:db_insert_placeholder_9] => 1
> [:db_insert_placeholder_10] =>
> [:db_insert_placeholder_11] =>
> )
> in Drupal\mysql\Driver\Database\mysql\ExceptionHandler->handleExecutionException() (line 50 of /var/www/html/web/core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php).
> [error] The entity update process failed while processing the entity type group_content, ID: 1.
> [error] Update failed: group_update_9201
[error] Update aborted by: group_update_9201
[error] Finished performing updates.
Failed to run drush updb: exit status 1 Steps to reproduce
I was testing on my local with a very simple Group 1.4 site with a single group.
thank you!
-mike
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | update.txt | 1.26 KB | fmb |
| #21 | error.png | 25.34 KB | fmb |
| #16 | group-3298788-16.patch | 10.27 KB | kristiaanvandeneynde |
Comments
Comment #2
mxr576Comment #3
kristiaanvandeneyndeHmm, that shouldn't happen. An update hook should not be resaving entities. That's what post update hooks are for. If we can figure out why these entities are resaved, then we can avoid or fix this error.
But for now the upgrade path might not be fully functional yet, this should of course be working as soon as we go into beta.
Comment #4
kristiaanvandeneyndeWe should be able to fix this by introducing GroupContentStorage::restore() just like we had to create GroupStorage::restore() a while back
Comment #5
kristiaanvandeneyndeTry this.
Comment #6
kristiaanvandeneyndeAlso bumping priority as this is quite annoying for people trying out the new release.
Comment #7
ultimikeI found a few minutes today to do some initial testing of the patch in #5 above.
Initially, it didn't work due to (I believe) a missing
usestatement in the patch:use Drupal\Core\Entity\EntityInterface;Once I added that, things progressed a bit farther, but I ended up with the following error when running
drush updb:I hope this is helpful.
Thanks, @kristiaanvandeneynde for your diligence on this issue!
-mike
Comment #8
kristiaanvandeneyndePlease make sure you're using the latest dev, though, as a lot of things got renamed in dev. Here's a reroll.
Comment #9
ultimikeStill no luck, unfortunately. Here's what I did:
1. I updated both Group and Flexible Permissions to their latest dev versions.
2. I tried to rebuild caches, but consistently received the error:
Looking at flexible_permissions.services.yml, the "flexible_permissions.chain_calculator" is indeed listed.
3. I tried to run a database update, but it failed as well:
Thoughts?
-mike
Comment #10
kristiaanvandeneyndeI'm in the process of fixing this, I found that renaming the handlers and classes required an entity update to run. Doing so now and that might fix things.
Comment #11
kristiaanvandeneyndeThis condenses the entity type updates and puts them at the very front of the list. I suppose it's okay to do this while in alpha.
Comment #12
ultimikeNo luck - similar, but not exact issue.
1.
drush crleads to theerror.
2.
drush updbleads to a new error:-mike
Comment #13
kristiaanvandeneyndeHmm okay, will continue to work on this. Thanks for the review.
Comment #14
kristiaanvandeneyndeOkay so make sure you first install the new dependency: https://www.drupal.org/project/flexible_permissions
Then try this patch. I've just condensed everything into one update hook at the top, hopefully that makes it stop complaining about needing batch updates. It does on my end, but I'd love to see the same on your end :)
Comment #15
kristiaanvandeneyndeSorry use this one instead.
Comment #16
kristiaanvandeneyndeOkay so here's what I did to get it to work:
Download and install FP before you update Group's code.
The latest patch circumvents a catch-22 with the old storage class gone missing yet somehow being required by Drupal for the updates.
Comment #17
ultimikeSo far, so good. I was able to upgrade from 1.x to 2.x using the instructions in comment 16.
But, after I did so, I was looking at a list of nodes belonging to one of my groups (via /group/1/nodes) and there is something odd going on.
It seems like something is getting confused with different entity types.
When I click "Add existing content" from /group/1/nodes, I get a blank page (the title and breadcrumbs are there, but no page content). Same for "Add new content".
Is this a bug with the upgrade path or something else?
-mike
Comment #18
ultimikeAfter further review, I think my comment #17 above was not correct, and therefore I'm pretty sure all is good.
I believe that originally, my group did not have 3 nodes, but only 1.
I was also confused that when I clicked on a node title on the "All entities" page (/group/1/content) I wasn't seeing the node, but rather the group relationship.
-mike
Comment #20
kristiaanvandeneyndeWill tag a beta with this shortly.
Thanks for the feedback @ultimike!
Comment #21
fmb commentedWith 2.0.0-beta1, I get this error in the status report, as well as messages containing "Table 'db.group_relationship_field_data' doesn't exist". Is this related to this issue? What should I do?
Comment #22
fmb commentedApparently `drush updb` had returned no error.
When I try to force an entity update with the devel entity updates module (drush entup command), I get this message: "The entity schema update for the group_content entity type requires a data migration."
Comment #23
fmb commentedI ended up reinstalling the module.
Comment #24
fonant commentedGot it working, after trying to upgrade without enabling flexible_permissions first.
1. Downgrade group
composer require 'drupal/group:^1.5' -W2. Get flexible_permissions code
composer require 'drupal/flexible_permissions:^1.0@beta'3. Install (enable) flexible_permissions
drush pm-enable flexible_permissions4. Update group code
composer require 'drupal/group:^2.0@beta'5. Update database
drush updatedbComment #25
kristiaanvandeneyndeYeah that bit is important, it's at the top of the release notes for that reason :)
Comment #27
rondog469 commentedAm I wrong in thinking this modules composer.json require flexible permissions? I ran into this issue because I did not see the release notes from the first beta.
Comment #28
programmerdiego commentedEnvironment: Drupal v9.5.7, Groups Module v1.5.
I had two patches on my composer.json
1) (https://www.drupal.org/files/issues/group-content-entity-tokens-2916907-...)
2) https://www.drupal.org/files/issues/2022-02-09/group-fix-group-revisions...)
I removed both of my patches and ran the following and got my system to work.
1. Install Flexible Permissions: 'drupal/flexible_permissions:^1.0@beta'
2. Enabled Flexible Permissions: 'drush pm-enable flexible_permissions'
3. Update Group Module: 'composer require 'drupal/group:^2.0@beta'
4. Update database: 'lando drush updb'
Comment #29
pdcarto commentedAnybody reading all the way to the bottom of this issue thread may wonder why it's marked as "Fixed", when the last comment describes a bunch of manual steps. That's because those steps were added in the group.install file in 2.0.x: https://www.drupal.org/project/group/issues/3355034#comment-15075342