pub trait MigrationTrait:
MigrationName
+ Send
+ Sync {
// Required method
fn up<'life0, 'life1, 'async_trait>(
&'life0 self,
manager: &'life1 SchemaManager<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided methods
fn down<'life0, 'life1, 'async_trait>(
&'life0 self,
_manager: &'life1 SchemaManager<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn use_transaction(&self) -> Option<bool> { ... }
}Expand description
The migration definition
Required Methods§
Provided Methods§
Sourcefn down<'life0, 'life1, 'async_trait>(
&'life0 self,
_manager: &'life1 SchemaManager<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn down<'life0, 'life1, 'async_trait>(
&'life0 self,
_manager: &'life1 SchemaManager<'_>,
) -> Pin<Box<dyn Future<Output = Result<(), DbErr>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Define actions to perform when rolling back the migration
Sourcefn use_transaction(&self) -> Option<bool>
fn use_transaction(&self) -> Option<bool>
Control whether this migration runs inside a transaction.
None(default): follow backend convention (Postgres = transaction, MySQL/SQLite = no transaction)Some(true): force wrapping in a transaction on any backendSome(false): disable automatic transaction wrapping (usemanager.begin()for manual control)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".