Overview
Zeus uses SQLx CLI for database migrations. Migrations are version-controlled and applied in order.Creating Migrations
Migration File Format
Running Migrations
Apply All
Check Status
Revert Last
Migration Best Practices
- Never modify existing migrations - Create new ones instead
- Make migrations reversible - Always provide down.sql
- Test migrations - Run on a copy of production data
- Keep migrations small - One logical change per file
- Use transactions - Wrap in BEGIN/COMMIT for safety
Example Migration
Adding a new column:Migration Checklist
- Test on development database
- Ensure down migration works
- Check for data loss
- Update application code
- Document changes
- Backup production database

