pub enum Column<'a> {
Add(&'a Column),
Drop(&'a Column),
Alter {
previous: &'a Column,
next: &'a Column,
},
}Expand description
A single column-level change between two table versions.
Computed by Column::diff.
Variants§
Add(&'a Column)
A new column was added.
Drop(&'a Column)
An existing column was removed.
Alter
A column was modified (name, type, nullability, or other property changed).
Implementations§
Source§impl<'a> Column<'a>
impl<'a> Column<'a>
Sourcepub fn diff(
cx: &Context<'a>,
previous: &'a [Column],
next: &'a [Column],
) -> Vec<Self>
pub fn diff( cx: &Context<'a>, previous: &'a [Column], next: &'a [Column], ) -> Vec<Self>
Computes the diff between two column slices.
Uses Context to resolve rename hints. Columns matched by name (or
by rename hint) are compared field-by-field; unmatched columns in
previous become drops, and unmatched columns in next become adds.
§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::Column::diff(&cx, &[], &[]).is_empty());Auto Trait Implementations§
impl<'a> Freeze for Column<'a>
impl<'a> RefUnwindSafe for Column<'a>
impl<'a> Send for Column<'a>
impl<'a> Sync for Column<'a>
impl<'a> Unpin for Column<'a>
impl<'a> UnsafeUnpin for Column<'a>
impl<'a> UnwindSafe for Column<'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