# Squash

## Goal

Replace a chain of migrations, such as `users`, `users-add-email`, `users-add-locale`, by a single migration for fresh deployments, while deployments that already have the chain keep it. Prior art: Django's `squashmigrations` with `replaces = [...]`. A squashed migration counts as applied where all replaced ones are applied; a fresh deployment runs only the squashed one.

## Why

Long chains accumulate as a project evolves, and fresh deployments replay all of them. This also covers the "the new version supersedes the old one" idea from the original rework discussion, which was deliberately left out of rework.

## Already settled

- Rework keeps the previous version in every deployment's history, precisely because skipping it on fresh deployments can make histories diverge (column order, enum value order, catalog differences, `CASCADE` effects): ADR `cli/rework/rework-keeps-the-previous-version-in-every-history`. Squash trades that guarantee for shorter histories and has to say how it handles the divergence.
- Rework applies to a single migration, squash to a chain (glossary: Rework).
