pub enum MigrationOperation {
Show 16 variants
CreateModel {
model: ModelState,
},
CreateTable {
table: TableState,
},
DropTable {
name: String,
},
AddColumn {
table: String,
column: ColumnState,
},
RemoveColumn {
table: String,
column: String,
},
RenameTable {
old_name: String,
new_name: String,
},
RenameColumn {
table: String,
old_name: String,
new_name: String,
},
AlterColumn {
table: String,
old_column: ColumnState,
new_column: ColumnState,
},
AddIndex {
table: String,
columns: Vec<String>,
},
RemoveIndex {
table: String,
columns: Vec<String>,
},
AddUniqueConstraint {
table: String,
columns: Vec<String>,
},
RemoveUniqueConstraint {
table: String,
columns: Vec<String>,
},
BackfillColumn {
table: String,
column: String,
value: String,
},
CreateSchemaObject {
object: SchemaObjectState,
},
DropSchemaObject {
kind: SchemaObjectKind,
name: String,
},
RunSql {
forward: String,
reverse: Option<String>,
state_operations: Vec<MigrationOperation>,
},
}Expand description
A migration state transition.
Variants§
CreateModel
Fields
§
model: ModelStateCreateTable
Fields
§
table: TableStateDropTable
AddColumn
RemoveColumn
RenameTable
RenameColumn
AlterColumn
AddIndex
RemoveIndex
AddUniqueConstraint
RemoveUniqueConstraint
BackfillColumn
Updates only existing NULL values before a later schema constraint.
value is a reviewed SQLite expression, for example "'unknown'"
or "coalesce(title, 'untitled')".
CreateSchemaObject
Fields
§
object: SchemaObjectStateDropSchemaObject
RunSql
Implementations§
Source§impl MigrationOperation
impl MigrationOperation
Sourcepub fn state_forwards(
&self,
state: &mut ProjectState,
) -> Result<(), MigrationError>
pub fn state_forwards( &self, state: &mut ProjectState, ) -> Result<(), MigrationError>
Applies this operation to the in-memory schema state.
Trait Implementations§
Source§impl Clone for MigrationOperation
impl Clone for MigrationOperation
Source§impl Debug for MigrationOperation
impl Debug for MigrationOperation
impl Eq for MigrationOperation
Source§impl PartialEq for MigrationOperation
impl PartialEq for MigrationOperation
impl StructuralPartialEq for MigrationOperation
Auto Trait Implementations§
impl Freeze for MigrationOperation
impl RefUnwindSafe for MigrationOperation
impl Send for MigrationOperation
impl Sync for MigrationOperation
impl Unpin for MigrationOperation
impl UnsafeUnpin for MigrationOperation
impl UnwindSafe for MigrationOperation
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