pub struct SchemaDiff {
pub operations: Vec<Operation>,
pub ambiguous: Vec<AmbiguousChange>,
pub warnings: Vec<DiffWarning>,
}Expand description
Result of comparing two schema snapshots.
Fields§
§operations: Vec<Operation>The migration operations to apply.
ambiguous: Vec<AmbiguousChange>Changes that may be renames and need user confirmation.
warnings: Vec<DiffWarning>Informational warnings (destructive changes that require manual intervention, column order changes, etc.).
Implementations§
Source§impl SchemaDiff
impl SchemaDiff
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if there are no changes at all (no ops,
no ambiguous changes, and no warnings).
Sourcepub fn to_sql(&self, dialect: &impl MigrationDialect) -> Vec<String>
pub fn to_sql(&self, dialect: &impl MigrationDialect) -> Vec<String>
Convenience: generates SQL for every operation using the given dialect.
Sourcepub fn reverse(&self) -> Option<Self>
pub fn reverse(&self) -> Option<Self>
Attempts to reverse the entire diff. Returns None if any
operation is non-reversible.
Sourcepub fn is_reversible(&self) -> bool
pub fn is_reversible(&self) -> bool
Returns true if every operation is reversible.
Sourcepub fn non_reversible_operations(&self) -> Vec<&Operation>
pub fn non_reversible_operations(&self) -> Vec<&Operation>
Returns references to the non-reversible operations.
Trait Implementations§
Source§impl Clone for SchemaDiff
impl Clone for SchemaDiff
Source§fn clone(&self) -> SchemaDiff
fn clone(&self) -> SchemaDiff
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaDiff
impl Debug for SchemaDiff
Source§impl PartialEq for SchemaDiff
impl PartialEq for SchemaDiff
impl StructuralPartialEq for SchemaDiff
Auto Trait Implementations§
impl Freeze for SchemaDiff
impl RefUnwindSafe for SchemaDiff
impl Send for SchemaDiff
impl Sync for SchemaDiff
impl Unpin for SchemaDiff
impl UnsafeUnpin for SchemaDiff
impl UnwindSafe for SchemaDiff
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