Skip to main content

DataMigrationHook

Trait DataMigrationHook 

Source
pub trait DataMigrationHook: Send + Sync {
    // Required methods
    fn before_drop_column<'a>(
        &'a self,
        conn: &'a mut dyn Connection,
        table: &'a str,
        column: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'a>>;
    fn before_rename_column<'a>(
        &'a self,
        conn: &'a mut dyn Connection,
        table: &'a str,
        old_name: &'a str,
        new_name: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'a>>;
}
Expand description

数据迁移钩子 trait(v2.2.0 B-2)

在执行破坏性 DDL 前调用,允许用户执行数据备份或迁移。 手动解糖 async(与 Connection trait 一致)。

Required Methods§

Source

fn before_drop_column<'a>( &'a self, conn: &'a mut dyn Connection, table: &'a str, column: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'a>>

删除列前钩子(可执行数据备份)

Source

fn before_rename_column<'a>( &'a self, conn: &'a mut dyn Connection, table: &'a str, old_name: &'a str, new_name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'a>>

重命名列前钩子(可执行数据校验)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§