what is Flyway?
Flyway is one of several tools that propose to bring order and organization to SQL scripts that run in the database, functioning as a version control of the same.
what problems he proposes to remedy?
A tool like this allows:
- Synchronize the database with the application version;
- Know which SQL scripts were executed or not;
- Automate the execution of scripts;
- Create a database from scratch;
- Allows you to create a rollback of database changes (useful in rare cases).
when to use it?
I believe it is a valid option for projects of any size. As they are usually easy to configure and use tools, I don’t see many reasons to give it up, because it brings several advantages.
It may be expendable in some projects where Dbas are involved and these prefer to control SQL scripts applied outside the application.
what are the competing solutions?
Flyway is a tool for the Java ecosystem. There are other alternatives that also work with Java but are language-independent, such as Liquibase, that brings some characteristics to better interesting.
In the C# ecosystem I’ve had the opportunity to successfully use the Fluentmigrator. Currently, this type of tool is very common and each ecosystem provides some alternative.
it serves for multi-tenancy? if yes, for heterogeneous schema banks, it also serves?
Yes, to the two questions.
If the schemas are identical and there is one per tenant, Just iterate for each existing schema and run Flyway in each one. If they all have identical schemas, there will be a single history table that will be in the first schema of the list among the supported schemas.
If the schemas of each tenant are different, even with different life cycles, you can still use Flyway to control them, maintaining multiple instances of Flyway and allowing each instance to manage your schema and your history.
Some of the questions are answered at https://flywaydb.org
– Dherik
@Dherik, in fact this is the canonical reference. But since we do not have the canonical answer here in Sopt, I felt the need to ask this question
– Jefferson Quesado
Related interesting text: Evolutionary Database Design (Flyway is quoted at the end)
– Piovezan