-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
Problem
Our local dev/seed workflows can fail silently or be confusing. Example: a developer may run make db seed against a restored backup or a non-empty DB, then try default creds and assume “seed is broken”. The scripts/logs don’t clearly explain what happened, what DB they targeted, or why credentials didn’t apply.
Goal
Make seed/dev scripts human-friendly and hard to misuse.
Requirements
1) Human-friendly logging
- Print a clear banner at start:
- target environment (dev/stage/prod if applicable)
- DB host/port/name/user (redact passwords)
- whether DB is empty / contains data (row count heuristics)
- what actions will be executed (migrations, seed steps)
- Use structured logging where reasonable (zap/slog), but output must be readable in console.
- Print a summary at the end (created users, companies/tenants, etc.).
2) Safety checks (“foolproof mode”)
- Refuse to run destructive steps (drop/truncate) unless an explicit flag is provided:
- e.g.
--force,--i-know-what-im-doing, orSEED_FORCE=1
- e.g.
- Detect and warn if:
- DB is not local (host not
localhost/127.0.0.1/docker service) - DB already has data (non-empty) and seed would conflict/duplicate
- running against a restored backup (heuristic: presence of known prod/stage markers)
- DB is not local (host not
- Provide an interactive confirmation (TTY) when risk is detected, unless
--yesis supplied. - Exit with non-zero status on unsafe conditions.
3) Credential clarity
- Always print (or write to
.env.local/ output file) the default login credentials that were seeded. - If credentials already exist, log that seed skipped them and what to do next.
4) Developer UX
- Add
--dry-runto show what would happen. - Update README/docs: how to seed from scratch vs. how to work with backups.
Acceptance Criteria
- Running seed on a non-empty DB clearly explains what was detected and what was skipped/refused.
- Risky operations require explicit confirmation/flag.
- Default credentials are always discoverable from the output.
- Logs are understandable without reading the code.
Notes
This should cover both Go-based seed commands and any Makefile/dev scripts in the repo.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels