What is Flyway and when to use it?

5

The system recently called attention to this question , and it talks about Flyway.

So, I'd like to know:

  • What is Flyway?
  • What problems does he propose to heal?
  • When to use it?
  • What are the competing solutions?
  • Is it for multi-tenancy? if so, for heterogeneous schema banks, is it also?
asked by anonymous 19.02.2018 / 13:02

1 answer

1
  

What is Flyway?

Flyway is one of several tools that propose to bring order and organization to the SQL scripts that run in the database, working as a version control of the same.

  

What problems does he propose to heal?

A tool like this allows:

  • Synchronize the database with the application version;
  • Know which SQL scripts were executed or not;
  • Automate script execution;
  • Create a database from scratch;
  • Lets you create a rollback of changes in the database (useful in rare cases).
  

When to use it?

I think it's a good fit for projects of any size. Since they are often easy to set up and use tools, I do not see many reasons to give it up, as it brings a number of advantages.

It may be expendable on some projects where there are DBAs involved and they prefer to control the 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 independent of the language, such as the Liquibase , which brings some characteristics to better interesting .

In the C # ecosystem I have had the opportunity to successfully use FluentMigrator . Currently, this type of tool is very common and every ecosystem provides some alternative.

  

Is it for multi-tenancy? if yes, for heterogeneous schema banks, is it also?

Yes, for two questions .

If the schemas are identical and there is one for tenant , you simply have to iterate through each existing schema and run the Flyway on each. If all have identical schemas, there will be a single history table that will be in the first schema of the list of supported schemas.

If the schemas of each tenant are different, even with distinct lifecycles, you can still use Flyway to control them, keeping multiple instances of Flyway and allowing each instance to manage its schema and its history.

    
27.09.2018 / 05:40