pub struct Migrator { /* private fields */ }Implementations§
Source§impl Migrator
impl Migrator
pub fn new(context: MigrationContext) -> Self
pub fn add_migration(self, migration: Migration) -> Self
pub fn add_migrations(self, migrations: Vec<Migration>) -> Self
pub fn get_migrations(&self) -> &Vec<Migration>
pub fn get_pending_migrations(&self) -> Vec<&Migration>
pub fn get_applied_migrations(&self) -> Vec<&Migration>
pub fn latest_version(&self) -> Option<&str>
pub fn find_migration(&self, version: &str) -> Option<&Migration>
Sourcepub async fn up(
&mut self,
target_version: Option<&str>,
) -> Result<Vec<String>, DbError>
pub async fn up( &mut self, target_version: Option<&str>, ) -> Result<Vec<String>, DbError>
执行到指定版本(包括该版本)
Sourcepub async fn down(
&mut self,
target_version: Option<&str>,
) -> Result<Vec<String>, DbError>
pub async fn down( &mut self, target_version: Option<&str>, ) -> Result<Vec<String>, DbError>
回滚到指定版本(执行该版本之后所有迁移的 down SQL)
Sourcepub fn progress(&self) -> MigrationProgress
pub fn progress(&self) -> MigrationProgress
获取迁移进度
Auto Trait Implementations§
impl !RefUnwindSafe for Migrator
impl !UnwindSafe for Migrator
impl Freeze for Migrator
impl Send for Migrator
impl Sync for Migrator
impl Unpin for Migrator
impl UnsafeUnpin for Migrator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more