Skip to content

Add 2.4 migration to rename 'Staff' customer group to 'Store manager' - #804

Merged
KrzysztofPajak merged 1 commit into
developfrom
fix/staff-to-storemanager-migration
Sep 1, 2026
Merged

Add 2.4 migration to rename 'Staff' customer group to 'Store manager'#804
KrzysztofPajak merged 1 commit into
developfrom
fix/staff-to-storemanager-migration

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

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" and SystemName = SystemCustomerGroupNames.Staff ("Staff").
That commit renamed the system name to StoreManager and the display name to "Store manager" for new
installations, but existing installations still have the old CustomerGroup document in their database
with SystemName == "Staff". Since the codebase now resolves the store-manager group via
SystemCustomerGroupNames.StoreManager, any code path that looks the group up by system name (store-manager
permission checks, admin group assignment, etc.) silently fails to find it on an un-migrated, upgraded
installation.

Solution

Added MigrationUpdateStoreManagerCustomerGroup, a 2.4 upgrade migration that finds the existing
CustomerGroup with SystemName == "Staff" and updates it to SystemName == "StoreManager", also updating
its display Name to "Store manager" if the operator hasn't already customized it. The migration is a no-op
if 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

  1. On a database from before the "Staff" → "StoreManager" rename (or manually seed a CustomerGroup with
    SystemName = "Staff", Name = "Staff"), run the application so migrations execute.
  2. Confirm the CustomerGroup document now has SystemName = "StoreManager" and Name = "Store manager".
  3. Restart the application again and confirm the migration does not run twice (check the migration log /
    Identity record) and the document is unchanged.
  4. Confirm store-manager permission/group lookups (e.g. assigning a customer to the "Store manager" group in
    Admin → Customers → Customer groups) work as expected.

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
Copilot AI lite review requested due to automatic review settings September 1, 2026 18:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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’s SystemName from "Staff" to SystemCustomerGroupNames.StoreManager.
  • Optionally updates the group’s display Name to "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.

@KrzysztofPajak
KrzysztofPajak merged commit 6c14db6 into develop Sep 1, 2026
7 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/staff-to-storemanager-migration branch September 1, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants