Skip to main content

MigrationError

Enum MigrationError 

Source
#[non_exhaustive]
pub enum MigrationError {
Show 21 variants UncertainSqlStep { id: String, operation: usize, }, UncertainRustStep { id: String, callback: String, operation: usize, }, LockTimeout, LockReleaseUncertain { applied: Vec<String>, source: Box<MigrationError>, }, MissingDependency { id: String, dependency: String, }, Cycle { nodes: Vec<String>, }, MultipleHeads { heads: Vec<String>, }, ChecksumMismatch { id: String, history: String, file: String, }, Irreversible { id: String, reason: String, }, Io(Error), Json(Error), Orm(OrmError), Capability(BackendCapabilityError), UnsupportedBackend(BackendKind), State(String), UnregisteredRust(String), Usage(String), MysqlPartial { id: String, index: usize, total: usize, source: OrmError, }, MysqlOpPartial { id: String, index: usize, total: usize, summary: String, source: Box<MigrationError>, }, PostgresPartial { id: String, index: usize, total: usize, source: OrmError, }, PostgresOpPartial { id: String, index: usize, total: usize, summary: String, source: Box<MigrationError>, },
}
Expand description

Failure of a migration command, graph check, or DDL step.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

UncertainSqlStep

An explicit SQL script may have committed unrecorded effects.

Fields

§id: String

Migration id.

§operation: usize

Zero-based operation index.

§

UncertainRustStep

A non-transactional callback may have committed unrecorded effects.

Fields

§id: String

Migration id.

§callback: String

Callback name.

§operation: usize

Zero-based operation index in the recorded direction.

§

LockTimeout

The advisory migration lock could not be acquired before its deadline.

Use Migrator::lock_holder on this path to name the session that holds it.

§

LockReleaseUncertain

The run finished, but the release of the migration lock could not be confirmed (for example the lock session was lost), so lock ownership is uncertain. The listed migrations were applied (migrate) or unapplied (rollback); inspect before retrying.

Fields

§applied: Vec<String>

Ids written to (migrate) or removed from (rollback) the history table by this run.

§source: Box<MigrationError>

Why the release could not be confirmed.

§

MissingDependency

A migration lists a dependency that is not on disk.

Fields

§id: String

Migration that named the missing dependency.

§dependency: String

Missing migration id.

§

Cycle

The dependency graph contains a cycle.

Fields

§nodes: Vec<String>

Nodes of one cycle, starting and ending at the same id.

§

MultipleHeads

More than one leaf (unmerged heads).

Fields

§heads: Vec<String>

Leaf migration ids, sorted.

§

ChecksumMismatch

An applied migration’s file no longer matches the checksum recorded in the history table.

Fields

§id: String

Migration id.

§history: String

Checksum stored in siderite_migrations.

§file: String

Checksum of the file currently on disk.

§

Irreversible

A rollback was requested for a migration that cannot be reversed.

Fields

§id: String

Migration id.

§reason: String

Why reversal is impossible.

§

Io(Error)

Filesystem failure.

§

Json(Error)

Migration JSON could not be encoded or decoded.

§

Orm(OrmError)

The ORM backend rejected a statement or connection.

§

Capability(BackendCapabilityError)

A requested SQL feature is not supported by this backend.

§

UnsupportedBackend(BackendKind)

Schema migrations are only implemented for PostgreSQL, SQLite and MySQL.

§

State(String)

The operation does not apply to the current crate::state::ProjectState.

§

UnregisteredRust(String)

A named RunRust operation is not in the crate::registry::MigrationRegistry.

§

Usage(String)

Command-line usage error.

§

MysqlPartial

MySQL DDL committed earlier statements, then a later one failed.

Fields

§id: String

Migration id.

§index: usize

1-based statement that failed.

§total: usize

Number of SQL statements in the migration.

§source: OrmError

Driver error from the failing statement.

§

MysqlOpPartial

A MySQL data operation failed after earlier statements committed.

Fields

§id: String

Migration id.

§index: usize

1-based operation that failed.

§total: usize

Number of operations in the migration.

§summary: String

Short label of the failing operation.

§source: Box<MigrationError>

The operation’s own error.

§

PostgresPartial

A non-transactional PostgreSQL migration (atomic: false) failed on a statement after earlier statements committed.

Fields

§id: String

Migration id.

§index: usize

1-based statement that failed.

§total: usize

Number of SQL statements in the migration.

§source: OrmError

Driver error from the failing statement.

§

PostgresOpPartial

A RunRust step of a non-transactional PostgreSQL migration (atomic: false) failed after earlier statements committed.

Fields

§id: String

Migration id.

§index: usize

1-based operation that failed.

§total: usize

Number of operations in the migration.

§summary: String

Short label of the failing operation.

§source: Box<MigrationError>

The operation’s own error.

Implementations§

Source§

impl MigrationError

Source

pub fn state(msg: impl Into<String>) -> Self

State helper.

Source

pub fn usage(msg: impl Into<String>) -> Self

Usage helper.

Trait Implementations§

Source§

impl Debug for MigrationError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for MigrationError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for MigrationError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BackendCapabilityError> for MigrationError

Source§

fn from(source: BackendCapabilityError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for MigrationError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for MigrationError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<OrmError> for MigrationError

Source§

fn from(source: OrmError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more