Trait sqlx_migrator::operation::Operation
source · pub trait Operation<DB, State = ()>: Send + Sync{
// Required method
fn up<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 mut <DB as Database>::Connection,
state: &'life2 State
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn down<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 mut <DB as Database>::Connection,
state: &'life2 State
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn is_destructible(&self) -> bool { ... }
}
Expand description
Trait for operation
Required Methods§
sourcefn up<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 mut <DB as Database>::Connection,
state: &'life2 State
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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,
connection: &'life1 mut <DB as Database>::Connection,
state: &'life2 State
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Up command to be executed during migration apply
Provided Methods§
sourcefn down<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 mut <DB as Database>::Connection,
state: &'life2 State
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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,
connection: &'life1 mut <DB as Database>::Connection,
state: &'life2 State
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Down command to be executed during migration rollback. If it is not implemented than operation is irreversible operation.
sourcefn is_destructible(&self) -> bool
fn is_destructible(&self) -> bool
Whether up operation is destructible or not. If operation is destructible than user should answer before running migration through cli. By default up operation are false. Down operation are always destructible and cannot be changed
Implementations on Foreign Types§
source§impl<U, D> Operation<Any> for (U, D)
Available on (crate features postgres
or mysql
or sqlite
) and crate feature any
only.
impl<U, D> Operation<Any> for (U, D)
Available on (crate features
postgres
or mysql
or sqlite
) and crate feature any
only.fn up<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 mut AnyConnection,
_state: &'life2 ()
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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,
connection: &'life1 mut AnyConnection,
_state: &'life2 ()
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
source§impl<U, D> Operation<MySql> for (U, D)
Available on crate feature mysql
only.
impl<U, D> Operation<MySql> for (U, D)
Available on crate feature
mysql
only.fn up<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 mut MySqlConnection,
_state: &'life2 ()
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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,
connection: &'life1 mut MySqlConnection,
_state: &'life2 ()
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
source§impl<U, D> Operation<Postgres> for (U, D)
Available on crate feature postgres
only.
impl<U, D> Operation<Postgres> for (U, D)
Available on crate feature
postgres
only.fn up<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 mut PgConnection,
_state: &'life2 ()
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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,
connection: &'life1 mut PgConnection,
_state: &'life2 ()
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
source§impl<U, D> Operation<Sqlite> for (U, D)
Available on crate feature sqlite
only.
impl<U, D> Operation<Sqlite> for (U, D)
Available on crate feature
sqlite
only.