Most teams think of Flyway only when they need to manage ongoing database schema changes. But what if your project already has a complete, stable schema and you’re only now introducing version control? Or what if you want to incorporate your schema into a CI/CD pipeline for reliable, reproducible deployments?
In this guide, I’ll walk you through a real-world scenario where we used Flyway to baseline an existing MySQL database and then extended it to support version-controlled schema migrations in CI/CD, without disrupting production.
🚀 What is Flyway?
Flyway is a simple but powerful tool for managing database migrations. It applies versioned SQL scripts to your database and tracks them in a special table called flyway_schema_history .
Typical script names:
V1__initial_schema.sql V2__add_orders_table.sql V3__rename_column.sql
Enter fullscreen mode
Exit fullscreen mode
Flyway ensures these scripts run only once and in the correct order.…