wheels db setup
Setup a complete database by creating it, running migrations, and seeding data.
Synopsis
Description
The wheels db setup
command performs a complete database initialization in one command. It executes three operations in sequence:
Creates the database (
wheels db create
)Runs all migrations (
wheels dbmigrate latest
)Seeds the database with sample data (
wheels db seed
)
This is ideal for setting up a new development environment or initializing a test database.
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.
--skip-seed
Skip the database seeding step.
--seed-count=
Number of records to generate per model when seeding. Defaults to 5.
Examples
Basic Usage
Full setup with default options:
Setup Without Sample Data
Create and migrate only:
Setup Test Database
Production Setup
What It Does
The command executes these steps in order:
Create Database
Creates new database if it doesn't exist
Uses datasource configuration for connection details
Run Migrations
Executes all pending migrations
Creates schema from migration files
Seed Database (unless --skip-seed)
Generates sample data for testing
Creates specified number of records per model
Error Handling
If any step fails:
The command stops execution
Shows which step failed
Provides instructions for manual recovery
Common Use Cases
New Developer Setup
Reset Development Database
Continuous Integration
Best Practices
Use for development: Perfect for getting started quickly
Skip seeding in production: Use
--skip-seed
for productionCustomize seed count: More data for performance testing
Check migrations first: Ensure migrations are up to date
Related Commands
wheels db create
- Just create databasewheels db reset
- Drop and recreate everythingwheels dbmigrate latest
- Just run migrationswheels db seed
- Just seed data
Last updated
Was this helpful?