Reset and restore a Postgres database for a configured service.
See also: services.md, configuration.md, and commands.md
Basic restore from backup
devkit db reset myapp --backup /path/to/backup.dumpOptions
--env: Rails environment (defaults to the serviceenv)--db-name: override database name (DevKit will try to infer from Rails if not provided)--yes: auto-confirm destructive actions (honors--safe/DEVKIT_SAFE=1)--trace: show executed commands
How it works
- Drops and recreates the database via Rails tasks (
db:drop,db:create). - Restores using
pg_restorefor custom dumps orpsql -ffor SQL files. - Validates connectivity with
SELECT 1.
Requirements
psql,pg_restorein PATH for restore/validate steps.railsin PATH if DevKit needs to infer the DB name.
Passwords
- DevKit will prompt once for the Postgres password (if needed) and reuse it for all steps.
- To avoid prompts, export
PGPASSWORDin your environment before running:export PGPASSWORD=....