wheels db dump
Export database schema and data to a file.
Synopsis
Description
The wheels db dump
command exports your database to a SQL file that can be used for backups, migrations, or setting up new environments. It supports various options for customizing what gets exported.
Options
--output=
Output file path. Defaults to dump_[datasource]_[timestamp].sql
.
--datasource=
Specify which datasource to dump. If not provided, uses the default datasource.
--environment=
Specify the environment to use. Defaults to the current environment.
--schema-only
Export only the database structure (no data).
--data-only
Export only the data (no structure).
--tables=
Comma-separated list of specific tables to dump.
--compress
Compress the output file using gzip.
Examples
Basic Backup
Create a timestamped backup:
Production Backup
Schema Only Export
For version control:
Specific Tables
Export user-related tables:
Compressed Backup
Save space with compression:
Database-Specific Behavior
MySQL/MariaDB
Uses
mysqldump
utilityIncludes stored procedures and triggers
Preserves character sets and collations
PostgreSQL
Uses
pg_dump
utilityIncludes schemas, functions, and extensions
Handles permissions and ownership
SQL Server
Basic export functionality
For full backups, use SQL Server Management Studio
H2
Uses built-in SCRIPT command
Exports to SQL script format
Supports compression natively
Output Format
The dump file contains:
Database structure (CREATE TABLE statements)
Indexes and constraints
Data (INSERT statements)
Views, procedures (if supported)
Example output structure:
Common Use Cases
Daily Backups
Automated backup script:
Before Major Changes
Environment Sync
Data Migration
Performance Considerations
Large databases may take time to dump
Use
--compress
to reduce file sizeConsider
--tables
for partial backupsOff-peak hours for production dumps
Security Notes
Protect dump files - They contain sensitive data
Encrypt backups - Use additional encryption for sensitive data
Secure transfer - Use secure methods to transfer dumps
Clean up - Don't leave dump files in public directories
Troubleshooting
"mysqldump not found"
Install MySQL client tools:
"Permission denied"
Check database user has SELECT permissions
Ensure write permissions for output directory
Large Database Issues
Use
--compress
to reduce sizeConsider table-by-table exports
Increase timeout settings if needed
Related Commands
wheels db restore
- Restore from dumpwheels db status
- Check before dumpwheels db shell
- Manual export options
Last updated
Was this helpful?