Add 2.4 migration to rename 'Staff' customer group to 'Store manager' - #804
Merged
Merged
Conversation
Existing installations created before commit c2d7f7b still have a CustomerGroup document with SystemName "Staff" (and Name "Staff"), seeded by the old installer. Code now resolves the store-manager group via SystemCustomerGroupNames.StoreManager, so un-migrated installations silently lose that group after upgrade. This migration renames the existing document's SystemName to StoreManager and, if the operator hasn't customized it, updates its display Name to "Store manager". Idempotent: the lookup by SystemName == "Staff" no-ops on re-run once the rename has applied. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PJhfrkbb3mzYDrA7E23JYE
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Grand.Module.Migration 2.4 upgrade migration to bring pre-existing databases in line with the post-#570 rename of the built-in customer group from legacy SystemName = "Staff" to SystemName = "StoreManager" (display name “Store manager”), preventing upgraded installations from failing store-manager group lookups.
Changes:
- Introduces
MigrationUpdateStoreManagerCustomerGroup(DbVersion 2.4) to rename the legacy customer group’sSystemNamefrom"Staff"toSystemCustomerGroupNames.StoreManager. - Optionally updates the group’s display
Nameto"Store manager"only when it is still the original"Staff"value.
Validated: Not run (no execution environment provided).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #issueNumber
Type: bugfix
Issue
Before commit c2d7f7b ("Grand.Web.Store – A Store Management Module #570"), the installer seeded the
built-in customer group with
Name = "Staff"andSystemName = SystemCustomerGroupNames.Staff("Staff").That commit renamed the system name to
StoreManagerand the display name to "Store manager" for newinstallations, but existing installations still have the old
CustomerGroupdocument in their databasewith
SystemName == "Staff". Since the codebase now resolves the store-manager group viaSystemCustomerGroupNames.StoreManager, any code path that looks the group up by system name (store-managerpermission checks, admin group assignment, etc.) silently fails to find it on an un-migrated, upgraded
installation.
Solution
Added
MigrationUpdateStoreManagerCustomerGroup, a2.4upgrade migration that finds the existingCustomerGroupwithSystemName == "Staff"and updates it toSystemName == "StoreManager", also updatingits display
Nameto "Store manager" if the operator hasn't already customized it. The migration is a no-opif no such group exists (fresh installs) and is idempotent (re-running finds nothing once the rename has
applied, since the lookup is by the old system name).
Breaking changes
None. This only corrects data left behind by an earlier code rename; the target state ("StoreManager" /
"Store manager") already matches what fresh installations get.
Testing
CustomerGroupwithSystemName = "Staff",Name = "Staff"), run the application so migrations execute.CustomerGroupdocument now hasSystemName = "StoreManager"andName = "Store manager".Identityrecord) and the document is unchanged.Admin → Customers → Customer groups) work as expected.