Documentation
¶
Overview ¶
Command backfill-customer-role provisions the global "Customer" role in the database and assigns it to customer-portal account users.
It is idempotent (fixed IDs; syncs to an exact state) and safe to re-run. It:
- creates the global Customer role (role_type "user", account_id NULL) if absent,
- syncs its role_permission rows to EXACTLY customerRolePermissions (adds missing, removes stale),
- backfills account_user.role_id = <Customer role> for every ACTIVE account_user of a customer (counterparty) account,
- migrates any lingering references off the legacy role id and removes it.
Usage:
DB_URL=<dsn-or-mysql-url> go run ./cmd/backfill-customer-role --dry-run DB_URL=<dsn-or-mysql-url> go run ./cmd/backfill-customer-role
Flags:
--dry-run report what would change; make no writes.
--skip-subscribed also skip accounts that have their own active/trialing
subscription (real merchants who are also someone's customer).
Click to show internal directories.
Click to hide internal directories.