pub enum StateChange {
CreateModel(ModelState),
DeleteModel(ModelState),
RenameTable {
key: ModelKey,
old_name: String,
new_name: String,
},
AddColumn {
key: ModelKey,
table: String,
column: ColumnState,
},
RemoveColumn {
key: ModelKey,
table: String,
column: ColumnState,
},
AlterColumn {
key: ModelKey,
table: String,
old_column: ColumnState,
new_column: ColumnState,
},
AddIndex {
key: ModelKey,
table: String,
columns: Vec<String>,
},
RemoveIndex {
key: ModelKey,
table: String,
columns: Vec<String>,
},
AddUniqueConstraint {
key: ModelKey,
table: String,
columns: Vec<String>,
},
RemoveUniqueConstraint {
key: ModelKey,
table: String,
columns: Vec<String>,
},
CreateSchemaObject(SchemaObjectState),
DeleteSchemaObject(SchemaObjectState),
}Expand description
A deterministic difference between historical and current model state.
Field renames keep their physical SQL column when db_column preserves it.
Variants§
CreateModel(ModelState)
DeleteModel(ModelState)
RenameTable
AddColumn
RemoveColumn
AlterColumn
AddIndex
RemoveIndex
AddUniqueConstraint
RemoveUniqueConstraint
CreateSchemaObject(SchemaObjectState)
DeleteSchemaObject(SchemaObjectState)
Implementations§
Source§impl StateChange
impl StateChange
Sourcepub fn into_operation(self) -> MigrationOperation
pub fn into_operation(self) -> MigrationOperation
Converts a state difference into the forward-only operation that
reproduces it. ModelKey is used while calculating the difference;
the resulting operation carries the database state it needs to apply.
Trait Implementations§
Source§impl Clone for StateChange
impl Clone for StateChange
Source§impl Debug for StateChange
impl Debug for StateChange
impl Eq for StateChange
Source§impl PartialEq for StateChange
impl PartialEq for StateChange
impl StructuralPartialEq for StateChange
Auto Trait Implementations§
impl Forget for StateChange
impl Freeze for StateChange
impl Move for StateChange
impl RefUnwindSafe for StateChange
impl Send for StateChange
impl Sync for StateChange
impl Unpin for StateChange
impl UnsafeUnpin for StateChange
impl UnwindSafe for StateChange
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