pub trait QueryMigrations {
// Required methods
fn applied_migrations(&self) -> Result<Vec<String>, ConnectionError>;
fn available_migrations(&self) -> Result<Vec<String>, ConnectionError>;
fn rollback_to_version(
&self,
version: &str,
) -> Result<Vec<String>, ConnectionError>;
fn run_migration(&self, name: &str) -> Result<(), ConnectionError>;
fn revert_migration(&self, name: &str) -> Result<(), ConnectionError>;
fn run_pending_migrations(&self) -> Result<Vec<String>, ConnectionError>;
}Expand description
Trait for database migration operations.
WARNING: These operations are dangerous and can cause data loss. They are intended for debugging and admin tools only.
Required Methods§
Sourcefn applied_migrations(&self) -> Result<Vec<String>, ConnectionError>
fn applied_migrations(&self) -> Result<Vec<String>, ConnectionError>
Returns a list of all applied migration versions, most recent first.
Sourcefn available_migrations(&self) -> Result<Vec<String>, ConnectionError>
fn available_migrations(&self) -> Result<Vec<String>, ConnectionError>
Returns a list of all available (embedded) migration names.
Sourcefn rollback_to_version(
&self,
version: &str,
) -> Result<Vec<String>, ConnectionError>
fn rollback_to_version( &self, version: &str, ) -> Result<Vec<String>, ConnectionError>
Rollback all migrations after and including the specified version.
WARNING: This is destructive and may cause data loss.
Sourcefn run_migration(&self, name: &str) -> Result<(), ConnectionError>
fn run_migration(&self, name: &str) -> Result<(), ConnectionError>
Run a specific migration by name.
NOTE: This runs the migration SQL directly without updating the schema_migrations tracking table.
Sourcefn revert_migration(&self, name: &str) -> Result<(), ConnectionError>
fn revert_migration(&self, name: &str) -> Result<(), ConnectionError>
Revert a specific migration by name.
NOTE: This runs the revert SQL directly without updating the schema_migrations tracking table.
Sourcefn run_pending_migrations(&self) -> Result<Vec<String>, ConnectionError>
fn run_pending_migrations(&self) -> Result<Vec<String>, ConnectionError>
Run all pending migrations.