Skip to main content

Table

Enum Table 

Source
pub enum Table<'a> {
    Create(&'a Table),
    Drop(&'a Table),
    Alter {
        previous: &'a Table,
        next: &'a Table,
        columns: Vec<Column<'a>>,
        indices: Vec<Index<'a>>,
    },
}
Expand description

A single table-level change between two schema versions.

Computed by Table::diff.

Variants§

§

Create(&'a Table)

A new table was created.

§

Drop(&'a Table)

An existing table was dropped.

§

Alter

A table was modified (name, columns, or indices changed).

Fields

§previous: &'a Table

The table definition before the change.

§next: &'a Table

The table definition after the change.

§columns: Vec<Column<'a>>

Column-level changes within this table.

§indices: Vec<Index<'a>>

Index-level changes within this table.

Implementations§

Source§

impl<'a> Table<'a>

Source

pub fn diff( cx: &Context<'a>, previous: &'a [Table], next: &'a [Table], ) -> Vec<Self>

Computes the diff between two table slices.

Uses Context to resolve rename hints. Tables matched by name (or by rename hint) are compared for column and index changes; unmatched tables in previous become drops, and unmatched tables in next become creates.

§Examples
use toasty_core::schema::{db, diff};

let previous = db::Schema::default();
let next = db::Schema::default();
let hints = diff::RenameHints::new();
let cx = diff::Context::new(&previous, &next, &hints);
assert!(diff::Table::diff(&cx, &[], &[]).is_empty());

Auto Trait Implementations§

§

impl<'a> Freeze for Table<'a>

§

impl<'a> RefUnwindSafe for Table<'a>

§

impl<'a> Send for Table<'a>

§

impl<'a> Sync for Table<'a>

§

impl<'a> Unpin for Table<'a>

§

impl<'a> UnsafeUnpin for Table<'a>

§

impl<'a> UnwindSafe for Table<'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.

§

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