Flyway is an open-source tool database versioning tool, licensed under Apache License 2.0, that helps you implement automated and version-based database migrations. It allows you to define the required update operations in an SQL script or as Java code. You can then run the migration from a command line client or automatically as part of your build process or integrated into your Java application. The good thing about this process is that Flyway detects the required update operations and executes them. So, you don’t need to know which SQL update statements need to be performed to update your current database.
By default flyway creates table called flyway_schema_history, to maintain it’s meta data.
Your app will continue to work fine. It’s just a MySQL warning.
Flyway is created in Java. Therefore Java 1.8 + is needed as pre-requisite.
It’s very straight forward. Download Flyway from here. Unzip the file and place it to your choice of location. It too includes MySQL JDBC driver as well. So, you don’t have to download the driver saperately. It is available for number of platform. Download it, as per your requirement.
You can integrate flyway into your application or you can run it automatically as part the of the build process or manually from the command line.
Edit conf/flyway.conf configuration file and modify three important parameters.
All the migrations are stored under sql directory.
# JDBC url to use to connect to the database flyway.url=jdbc:mysql://192.168.150.214:3306/inventory?useSSL=false # User to use to connect to the database. Flyway will prompt you to enter it if not specified. flyway.user=flyway_inventory # Password to use to connect to the database. Flyway will prompt you to enter it if not specified. flyway.password=Abc@123
Flyway supports the following basic commands to manage database migrations using the command line.
# Clean: Drops all objects in a configured schema. All database objects are dropped. Of course, you should n