Skip to main content

squash

Function squash 

Source
pub fn squash(
    graph: &MigrationGraph,
    from_id: &str,
    to_id: &str,
    name: Option<&str>,
) -> Result<Migration, MigrationError>
Expand description

Squash the inclusive range from_id..=to_id (in graph order) into one migration.

Concatenates operations and applies:

  • CreateModel followed by AddField on the same model merges the field into the create
  • CreateModel + later DeleteModel of the same model (and ops on it in between) cancel

The result has replaces set to the squashed ids. Dependencies are those of the first migration in the range that are not themselves replaced.

ยงErrors

Unknown ids, a non-contiguous range, or checksum encoding.