pub enum MigrationOp {
CreateTable {
name: String,
schema: TableSchemaSnapshot,
},
DropTable {
name: String,
},
AddColumn {
table: String,
column: ColumnSnapshot,
},
DropColumn {
table: String,
column: String,
},
RenameColumn {
table: String,
old: String,
new: String,
},
AlterColumn {
table: String,
column: String,
changes: ColumnChanges,
},
WidenColumn {
table: String,
column: String,
old_type: DataTypeSnapshot,
new_type: DataTypeSnapshot,
},
TransformColumn {
column: String,
table: String,
old_type: DataTypeSnapshot,
new_type: DataTypeSnapshot,
},
AddIndex {
table: String,
index: IndexSnapshot,
},
DropIndex {
table: String,
index: IndexSnapshot,
},
}Expand description
Single atomic step produced by the migration planner.
Ops are sorted into a deterministic apply order (creates → drops → renames → relaxations → widening/transforms → adds → tightenings → indexes → table drops) and then executed inside a single journaled session.
Variants§
CreateTable
Create a new table with the given snapshot.
Fields
schema: TableSchemaSnapshotSnapshot of the compiled schema for the new table.
DropTable
Drop a table and all of its data. Destructive.
AddColumn
Append a new column to an existing table.
If the column is non-nullable, the planner must have resolved a default
value (#[default] or Migrate::default_value) before emitting this
op.
DropColumn
Drop a column and discard its data. Destructive.
RenameColumn
Rename a column, preserving its data and constraints.
Fields
AlterColumn
Change one or more constraint flags on an existing column.
Fields
changes: ColumnChangesFlag deltas to apply.
WidenColumn
Widen a column to a larger compatible type (sign-extend, zero-extend,
Float32 → Float64).
Fields
old_type: DataTypeSnapshotStored data type before widening.
new_type: DataTypeSnapshotCompiled data type after widening.
TransformColumn
Convert a column to an incompatible type using
Migrate::transform_column.
Fields
old_type: DataTypeSnapshotStored data type before the transform.
new_type: DataTypeSnapshotCompiled data type after the transform.
AddIndex
Build a new secondary index.
DropIndex
Drop an existing secondary index.
Trait Implementations§
Source§impl CandidType for MigrationOp
impl CandidType for MigrationOp
Source§impl Clone for MigrationOp
impl Clone for MigrationOp
Source§fn clone(&self) -> MigrationOp
fn clone(&self) -> MigrationOp
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more