pub trait Migration: Send + Sync {
// Required method
fn up(&self) -> Schema;
// Provided methods
fn down(&self) -> Option<Schema> { ... }
fn transactional(&self) -> bool { ... }
}Expand description
A single schema change.
Required Methods§
Provided Methods§
Sourcefn down(&self) -> Option<Schema>
fn down(&self) -> Option<Schema>
Statements that revert up, or None when the change
cannot be reversed safely (for example, dropping a table loses its data).
A batch containing an irreversible migration is never rolled back.
Sourcefn transactional(&self) -> bool
fn transactional(&self) -> bool
Whether to wrap the migration in a transaction. Defaults to true.
Opt out only for statements that cannot run inside a transaction; if a non-transactional migration fails, earlier statements may remain applied.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".