title: CLI Production Safety description: Guardrails for destructive operations in production.
CLI Production Safety
Goal
- Prevent accidental destructive operations in production.
- Keep operator intent explicit for high-risk commands.
Production guard contract
Destructive commands require the following whenAPP_ENV=production or NODE_ENV=production:
ELOQUENT_ALLOW_PROD_DESTRUCTIVE=true--force--yes
Choosing APP_ENV
Use APP_ENV to describe where the process is running.
APP_ENV=development- local development
- local test harnesses
- non-production integration work
- normal day-to-day CLI use on a developer machine
APP_ENV=production- real deployed environments
- production app servers
- controlled production migration jobs
- maintenance or release pipelines that touch production data
APP_ENV=production on your local machine unless you are intentionally validating production safety behavior.
Recommended combinations
Local development app
Local development migration run
Production app runtime
Production migration or maintenance job
Destructive commands (guarded)
make:modelmake:registrymake:controllermake:servicemake:seedmake:factorymake:scenariomake:migrationmigrate:freshmigrate:resetdb:seed:fresh
Safe commands
migrate:statusdb:seed(except precheck requirements for--all-connections)db:seed:precheckfactory:statuscache:statslist
Seed all-connections precheck
When running:- Run migrations first (
migrate:runormigrate:run --test). - Retry
db:seed.
Controlled production example
Recommended operational flow
- Run
migrate:statusbefore destructive commands. - Keep migration and seed operations inside CI/CD jobs.
- Use least-privilege credentials for runtime vs migration roles.
- Keep audit logs enabled around migration/seed windows.
Cache operations checklist
Use these commands during operational diagnosis or after destructive data resets:- inspect cache behavior with
cache:stats - clear cache after fresh rebuilds, restore tests, or seed resets if stale reads are suspected