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).
Implementations§
Source§impl<'a> Table<'a>
impl<'a> Table<'a>
Sourcepub fn diff(
cx: &Context<'a>,
previous: &'a [Table],
next: &'a [Table],
) -> Vec<Self>
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> 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