Skip to main content

mercato auth seed-roles

yarn mercato auth seed-roles inserts or verifies the default role set used by the authentication module.

Usage

yarn mercato auth seed-roles

Behavior

  • Runs inside a transaction and guarantees the roles employee, admin, and superadmin exist.
  • Existing roles are left untouched; missing ones are created with tenantId = null so they can be reused across tenants.
  • Outputs Inserted role <name> when a role is created and Roles ensured when complete.

When to Run

  • Immediately after project bootstrap (yarn init runs it automatically).
  • Before calling mercato auth setup in CI or scripts to make sure dependent roles exist.

Troubleshooting

  • Database connection errors — ensure DATABASE_URL is configured and the database is reachable.
  • Duplicate role warnings — harmless. The command is idempotent and skips roles that already exist.