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, andsuperadminexist. - Existing roles are left untouched; missing ones are created with
tenantId = nullso they can be reused across tenants. - Outputs
Inserted role <name>when a role is created andRoles ensuredwhen complete.
When to Run
- Immediately after project bootstrap (
yarn initruns it automatically). - Before calling
mercato auth setupin CI or scripts to make sure dependent roles exist.
Troubleshooting
- Database connection errors — ensure
DATABASE_URLis configured and the database is reachable. - Duplicate role warnings — harmless. The command is idempotent and skips roles that already exist.