wheels db version
Show the current database schema version.
Synopsis
wheels db version [--detailed]
Description
The wheels db version
command displays the current version of your database schema based on the last applied migration. This is useful for quickly checking which migration version your database is at.
Options
--detailed
Show additional information about the database state.
wheels db version --detailed
Examples
Basic Usage
Show current version:
wheels db version
Output:
Current database version: 20231203160000
Detailed Information
wheels db version --detailed
Output:
Current database version: 20231203160000
Last migration:
Version: 20231203160000
Description: CreatePostsTable
Applied at: 2023-12-03 16:45:32
Total migrations: 15
Pending migrations: 2
Next migration to apply:
Version: 20231204180000
Description: AddIndexToPostsUserId
Environment: development
Datasource: myapp_dev
Understanding Versions
Version Format
Migrations use timestamp-based versions:
Format:
YYYYMMDDHHMMSS
Example:
20231203160000
= December 3, 2023 at 4:00:00 PM
No Version
If you see "No migrations have been applied yet":
Database is fresh with no migrations run
Run
wheels dbmigrate latest
to apply migrations
Common Use Cases
Quick Check
Before running migrations:
wheels db version
wheels dbmigrate latest
Deployment Verification
# Check production is up to date
wheels db version --environment=production --detailed
Troubleshooting
Compare versions across environments:
# Development
wheels db version --environment=development
# Staging
wheels db version --environment=staging
# Production
wheels db version --environment=production
Related Information
The version corresponds to:
The latest migration file that has been applied
An entry in the migration tracking table
The current schema state of your database
Related Commands
wheels db status
- Show all migrations and their statuswheels dbmigrate latest
- Update to latest versionwheels db rollback
- Rollback to previous versionwheels dbmigrate info
- Detailed migration information
Last updated
Was this helpful?