Skip to main content

MigrationError

Enum MigrationError 

Source
pub enum MigrationError {
    SchemaDrift,
    IncompatibleType {
        table: String,
        column: String,
        old: DataTypeSnapshot,
        new: DataTypeSnapshot,
    },
    DefaultMissing {
        table: String,
        column: String,
    },
    ConstraintViolation {
        table: String,
        column: String,
        reason: String,
    },
    DestructiveOpDenied {
        op: String,
    },
    TransformAborted {
        table: String,
        column: String,
        reason: String,
    },
    WideningIncompatible {
        table: String,
        column: String,
        old_type: DataTypeSnapshot,
        new_type: DataTypeSnapshot,
    },
    TransformReturnedNone {
        table: String,
        column: String,
    },
    ForeignKeyViolation {
        table: String,
        column: String,
        target_table: String,
        value: String,
    },
}
Expand description

Error variants produced by the migration planner and apply pipeline.

Variants§

§

SchemaDrift

CRUD attempted while the DBMS is in drift state. Only ACL and migration entry points are allowed until MigrationOps are applied.

§

IncompatibleType

A column changed to a type that is neither in the widening whitelist nor handled by Migrate::transform_column.

Fields

§table: String

Table the column belongs to.

§column: String

Name of the offending column.

§old: DataTypeSnapshot

Stored data type.

§new: DataTypeSnapshot

Compiled data type.

§

DefaultMissing

AddColumn on a non-nullable column has neither a #[default] attribute nor a Migrate::default_value override.

Fields

§table: String

Table the column belongs to.

§column: String

Name of the offending column.

§

ConstraintViolation

A tightening AlterColumn op (e.g. nullable: false, unique: true, add FK) found existing data that violates the new constraint.

Fields

§table: String

Table the column belongs to.

§column: String

Name of the offending column.

§reason: String

Human-readable description of which row(s) violated the constraint.

§

DestructiveOpDenied

Planner produced a destructive op while MigrationPolicy::allow_destructive is false.

Fields

§op: String

Short tag for the offending op (e.g. "DropTable", "DropColumn").

§

TransformAborted

User-supplied Migrate::transform_column returned Err.

Fields

§table: String

Table the column belongs to.

§column: String

Name of the column being transformed.

§reason: String

Reason propagated from the user transform.

§

WideningIncompatible

Type change is outside the widening whitelist (IntN→IntM, UintN→UintM, UintN→IntM, Float32→Float64) and no Migrate::transform_column impl handled it.

Fields

§table: String

Table the column belongs to.

§column: String

Name of the offending column.

§old_type: DataTypeSnapshot

Stored data type before widening.

§new_type: DataTypeSnapshot

Compiled data type after widening.

§

TransformReturnedNone

User Migrate::transform_column returned Ok(None) while a transform was required (no widening rule available).

Fields

§table: String

Table the column belongs to.

§column: String

Name of the column being transformed.

§

ForeignKeyViolation

Add-FK tightening found a row whose value is absent from the target table’s referenced column.

Fields

§table: String

Source table that holds the foreign key column.

§column: String

Source column carrying the foreign key.

§target_table: String

Target table the FK references.

§value: String

Stringified value that failed the lookup.

Trait Implementations§

Source§

impl Clone for MigrationError

Source§

fn clone(&self) -> MigrationError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MigrationError

Source§

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

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

impl<'de> Deserialize<'de> for MigrationError

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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

1.30.0 · 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<MigrationError> for DbmsError

Source§

fn from(source: MigrationError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for MigrationError

Source§

fn eq(&self, other: &MigrationError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MigrationError

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for MigrationError

Source§

impl StructuralPartialEq for MigrationError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,