Problem/Motivation
#2953111: Only migrate role permissions that exist on the destination change the Role entity to emit an exception on a non-existent permission. It added a post update to fix roles. The problem is that post updates are supposed to run on a working system. But if this update has not taken place then any other post update cannot edit and save a role - this causes problems.
Steps to reproduce
Add post update to a module that comes before user... it will break if this update has not already run.
Proposed resolution
Move this update to hook_update_N
Add this post update to the removed list? Do we need to do that give 10.0.x is not out yet?
Remaining tasks
tbd
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
TBD
Comment | File | Size | Author |
---|---|---|---|
#5 | 3319845-9.x.patch | 545 bytes | alexpott |
#2 | 3319845-2.patch | 4.49 KB | alexpott |
|
Comments
Comment #2
alexpottWe already have test coverage in \Drupal\Tests\user\Functional\Update\UserUpdateRoleMigrateTest - I'm not sure that we need to batch these updates like I doubt that there are sites with more than a few hundred roles and we shouldn't be scared of a couple of hundred of updates. And this would be a very very very extreme case.
Comment #3
larowlanYeah I'd be dubious of any site with 100 roles, they would have bigger problems than update hook batching
Comment #4
larowlanComment #5
alexpottDiscussed with @catch we agreed to add a comment to user.install saying the D10 has a new update so adding one here is not recommended.
Comment #6
alexpottDo we need to add this to the list of removed updates? Or do we need to have it as an empty function? This has been released in a beta...
Comment #7
catchWe can't add it to removed updates - would prevent sites that haven't updated to the beta from updating. We could leave a stub though.
Comment #8
alexpottDiscussed with @catch and @longwave. @longwave pointed out that we'd removed an update during a beta before - see #3145501: updb error processMultivalueBaseFieldHandler() - I think this is okay tbh and cleaner than leaving an empty stub that people are going to see when updating to D10.
Comment #10
catchSo this means we really don't want to add any updates to user in 9.5.x from now onwards, however we can still add them to system for now if we have to and the comment in the 9.5.x patch is a good reminder.
The update switches from config entities to raw config API which is very much needed. The exception throwing is a good reason to move this to hook_update_N(), it's not quite a schema change but it's close.
Worst case that happens with just removing the post update is that sites already on the beta will have that update as cruft in their record of post updates, but this won't cause them any issues so don't think we need to do anything extra to support beta-beta/beta-rc updates.
Committed/pushed to 10.1.x and cherry-picked to 10.0.x, and the comment-only patch to 9.5,x thanks!
Comment #11
catchStatus field went completely wrong..