How to Achieve Flyway Rollbacks Without a Paid License Using Community Edition
A developer has published a method to perform database migration rollbacks using Flyway Community Edition, bypassing the need for the paid Teams license that gates the official 'undo' command. The approach exploits two core Flyway rules — that version numbers must always increase and the schema history table is authoritative — to express rollbacks as forward migrations. For each migration file, a corresponding 'down' script is maintained in a parallel directory, and when a rollback is triggered, the down script is applied as a new higher-versioned migration. The solution also tracks migration batches by diffing applied versions before and after each migrate run, storing the result in a JSON state file so the correct set of changes can be reversed. The schema history table is then cleaned up to keep the recorded state consistent with both the database and files on disk.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in