pub async fn db_migrate(url: &str, action: &str, steps: usize) -> Result<()>Expand description
Run database migrations.
Manages database schema migrations using SQLx auto-migration. Supports applying migrations, checking status, and rollback guidance.
§Arguments
url- Database connection URLaction- Migration action: “apply”, “rollback”, or “status”steps- Number of steps for rollback (currently requires manual rollback)
§Actions
- apply: Initialize schema and apply migrations
- status: Check current schema state
- rollback: Show manual rollback instructions
§Note
CeleRS uses SQLx auto-migration. For rollbacks, restore from database backup.
§Examples
// Apply migrations
db_migrate("postgresql://localhost/celers", "apply", 0).await?;
// Check status
db_migrate("postgresql://localhost/celers", "status", 0).await?;