QueryMigrations

Trait QueryMigrations 

Source
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§

Source

fn applied_migrations(&self) -> Result<Vec<String>, ConnectionError>

Returns a list of all applied migration versions, most recent first.

Source

fn available_migrations(&self) -> Result<Vec<String>, ConnectionError>

Returns a list of all available (embedded) migration names.

Source

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.

Source

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.

Source

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.

Source

fn run_pending_migrations(&self) -> Result<Vec<String>, ConnectionError>

Run all pending migrations.

Implementors§