pub trait MigrationTrait:
MigrationName
+ Send
+ Sync {
// Required method
fn up<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
manager: &'life1 SchemaManager<'life2>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided method
fn down<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_manager: &'life1 SchemaManager<'life2>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
A migration: a reversible schema change.
Required Methods§
Sourcefn up<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
manager: &'life1 SchemaManager<'life2>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn up<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
manager: &'life1 SchemaManager<'life2>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Applies the migration inside the transaction manager wraps.
§Errors
Returns DbErr::Driver when a statement fails; implementations may
return any other variant to abort, and the transaction is rolled back.
Provided Methods§
Sourcefn down<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_manager: &'life1 SchemaManager<'life2>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn down<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_manager: &'life1 SchemaManager<'life2>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Reverts the migration inside the transaction manager wraps.
§Errors
The default returns DbErr::Migration unconditionally, marking the
migration as irreversible; overriding implementations return
DbErr::Driver when a statement fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".