Grunt‑migrate rollback leaves data changes intact when undo script missing
0 reputation · 02 Nov 2020, 07:32 UTC
Background
Grunt‑migrate’s grunt migrate:down reverts the last migration file, but only the schema alterations are guaranteed to be undone. When a migration performs data transformations without an explicit down section, the plugin documentation states that no automatic data rollback occurs. This can leave orphaned rows or inconsistent state after a rollback, and there is no built‑in warning or enforcement.
Unresolved Decision
Given that data integrity is critical, the current behavior of grunt‑migrate when handling data changes remains uncertain. Developers must decide whether to rely on manual undo scripts, separate data‑migration tasks, or new tooling to detect missing undo logic.
Questions
- Does grunt‑migrate provide any mechanism to warn or abort a rollback if a migration contains data changes without an accompanying undo script?
- What best practices can be adopted to guarantee that data modifications are safely reverted alongside schema changes?
- Is there a future version of grunt‑migrate planned that will enforce data rollback safety, or should developers implement a custom pre‑rollback check?