

Then when a developer adds a second script, naming it as something like V2_another_script. When Flyway syncs up the database with this script, it adds to the schema_version table a record like this: installed_rank | version | description | type | script | checksum | installed_by | installed_on For example, let's say that our script is called V1_users. Then Flyway adds to it a record identifying that the first migration occurred. in the first migration), it creates a table called schema_version, with the following definition: # column name | column typeĭescription | varchar ( 200 ) type | varchar ( 20 ) Internally, Flyway controls the version of a database through records on a specific table in the database itself.


How Does Flyway Worksįlyway works by checking the current version of the database and by applying new migrations automatically before the rest of the application starts. With it, we can tightly integrate plain SQL scripts in the lifecycle of an application, guaranteeing that its database will always be compatible without manual intervention. What is Flywayįlyway is a tool, developed by Boxfuse, that enables developers to apply version control practices to the database that supports a Java application. But, what about our data and the schema that represents it? How do they keep in sync with the application that manipulates it? In this article, we are going to learn about Flyway, a solution that helps developers to handle version control of database schemas and data on Java applications. Source code versioning is a subject that has been widely discussed and which has many solutions created to address it, like Git, Subversion and Mercurial.
