pub fn invert(
forward: &[Operation],
prev: &SchemaSnapshot,
) -> Result<Vec<Operation>, MigrateError>Expand description
Compute the rollback form of a forward operation list.
Walks forward in reverse — the last op applied is the first
op rolled back. prev is the schema state before the
migration was applied (i.e. the predecessor migration’s snapshot,
or empty for the very first migration).
§Errors
Returns MigrateError::Validation if:
- Any data op has
reversible: false(cannot be rolled back). - A data op has
reversible: truebut noreverse_sql(corrupt —file::loadshould already have rejected this). - A
DropTable/DropColumnreferences something missing fromprev, meaning the predecessor snapshot was tampered with.