wheels db reset
Reset the database by dropping it and recreating it from scratch.
Synopsis
Description
The wheels db reset
command completely rebuilds your database by executing four operations in sequence:
Drops the existing database (
wheels db drop
)Creates a new database (
wheels db create
)Runs all migrations (
wheels dbmigrate latest
)Seeds the database with sample data (
wheels db seed
)
This is a destructive operation that will delete all existing data.
Options
--datasource=
Specify which datasource to use. If not provided, uses the default datasource from your Wheels configuration.
--environment=
Specify the environment to use. Defaults to the current environment.
--force
Skip the confirmation prompt. Use with caution!
--skip-seed
Skip the database seeding step.
--seed-count=
Number of records to generate per model when seeding. Defaults to 5.
Examples
Basic Usage
Reset with confirmation:
Force Reset
Reset without confirmation:
Reset Test Database
Reset Without Seeding
Safety Features
Confirmation Required: Must type "yes" to confirm (unless --force)
Production Warning: Extra warning for production environment
Special Production Confirmation: Must type "reset production database" for production
Warning
This operation is irreversible! All data will be permanently lost.
Common Use Cases
Development Reset
Before Major Changes
Automated Testing
What Happens
Drop Database
All tables and data are deleted
Database is completely removed
Create Database
Fresh database is created
Character set and collation are set (MySQL)
Run Migrations
All migrations run from scratch
Schema is recreated
Seed Database (unless --skip-seed)
Sample data is generated
Useful for development/testing
Error Recovery
If reset fails partway through:
Best Practices
Always backup production data first
Use --force only in automated scripts
Avoid resetting production databases
Use db setup for new databases instead
Related Commands
wheels db setup
- Setup new database (non-destructive)wheels db drop
- Just drop databasewheels db dump
- Backup before resetwheels dbmigrate reset
- Reset just migrations
Last updated
Was this helpful?