MigrationStatement

Struct MigrationStatement 

Source
pub struct MigrationStatement<'a> { /* private fields */ }
Expand description

A migration step pairing a DDL Statement with the [Schema] it applies against.

Each MigrationStatement carries a snapshot of the schema at the point where the statement should be serialized. This is necessary because rename and recreation operations modify the schema as they go.

Implementations§

Source§

impl<'a> MigrationStatement<'a>

Source

pub fn from_diff( schema_diff: &'a SchemaDiff<'a>, capability: &Capability, ) -> Vec<Self>

Generates migration statements from a [SchemaDiff].

Walks the diff’s table, column, and index changes and produces the corresponding DDL statements. On databases that lack ALTER COLUMN support (e.g. SQLite), column type changes trigger a full table recreation sequence.

Source

pub fn statement(&self) -> &Statement

Returns the DDL statement for this migration step.

Source

pub fn schema(&self) -> &Schema

Returns the schema snapshot this statement should be serialized against.

Auto Trait Implementations§

§

impl<'a> Freeze for MigrationStatement<'a>

§

impl<'a> RefUnwindSafe for MigrationStatement<'a>

§

impl<'a> Send for MigrationStatement<'a>

§

impl<'a> Sync for MigrationStatement<'a>

§

impl<'a> Unpin for MigrationStatement<'a>

§

impl<'a> UnwindSafe for MigrationStatement<'a>

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.

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, 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.