pub enum Down {
Statements(Vec<String>),
Irreversible(String),
}Expand description
How a migration undoes itself.
An enum rather than a possibly-empty Vec, because “this cannot be undone”
and “nobody wrote a down step” are different facts and only one of them is a
bug. A rollback refuses on Irreversible and
prints the reason, instead of doing nothing and reporting success.
Variants§
Statements(Vec<String>)
The statements that undo this migration, in the order they should run.
Irreversible(String)
Deliberately not reversible, and why.
A migration that drops a column or rewrites data cannot restore what it
destroyed. Saying so is more useful than a down that runs cleanly and
leaves the database subtly wrong.
Implementations§
Source§impl Down
impl Down
Sourcepub fn statements(statements: impl IntoIterator<Item = String>) -> Self
pub fn statements(statements: impl IntoIterator<Item = String>) -> Self
Undone by these statements.
Sourcepub fn irreversible(reason: impl Into<String>) -> Self
pub fn irreversible(reason: impl Into<String>) -> Self
Not reversible, for the stated reason.
Sourcepub fn sql(&self, migration: &str) -> Result<&[String]>
pub fn sql(&self, migration: &str) -> Result<&[String]>
The statements, or an error naming the migration and why it has none.
Sourcepub fn is_reversible(&self) -> bool
pub fn is_reversible(&self) -> bool
Whether this migration can be rolled back.
Trait Implementations§
impl Eq for Down
impl StructuralPartialEq for Down
Auto Trait Implementations§
impl Freeze for Down
impl RefUnwindSafe for Down
impl Send for Down
impl Sync for Down
impl Unpin for Down
impl UnsafeUnpin for Down
impl UnwindSafe for Down
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
A human-readable name, used by wildcard listeners and log output.
Always the Rust type path; see the trait docs.