Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flyway and liquibase together? [closed]

I've looked at both Liquibase and Flyway individually and on an individual comparison alone, Liquibase seems like the better tool for our needs. Some sources mention using both Liquibase and Flyway together. Liquibase seems to have everything Flyway has and more flexibility when it comes to rollbacks. The main advantage of just Flyway seems to be not having to use XML, but Liquibase allows you to specify an SQL file in their XML.

Basically, I'm still not clear on what the benefits of using Flyway & Liquibase together would be over just Liquibase, if there are any. Maybe there's a way to do it I'm not seeing as even if Liquibase was referring to valid Flyway SQL files, both tools would have to be run independently and still have the same pitfalls even though you could technically use either tool.

like image 999
Slayer0248 Avatar asked Aug 19 '16 17:08

Slayer0248


People also ask

Is Flyway better than Liquibase?

While both tools are based on Martin Fowler's Evolutionary Database, there are many differences in what these tools offer. Here's where Liquibase and Flyway differ. The bottom line is that Liquibase is more powerful and flexible — covering more database change and deployment use cases than Flyway.

Does Flyway support multiple databases?

During development you need a fast, automated way to build multiple copies of a database on any development or test server, with each database at the right version.

Can Liquibase migrate data?

Liquibase offers a powerful open source database migration tool for Java apps. It brings structure and confidence to developers and DBAs that need to easily create and track database schema changes.

Is Liquibase open source?

Track, version, and deploy database changes. Liquibase Community is an open source project that helps millions of developers rapidly manage database schema changes.


1 Answers

A small correction, before I answer question. The assumption

Liquibase seems to have everything Flyway has

isn't correct. Flyway shines when it comes to parsing SQL. You can use unmodified SQL files generated by your native tools containing all kinds of complexity like PL/SQL packages and procedures, MySQL delimiter changes, T-SQL, PostgreSQL procedures, ... With Liquibase you would have to split these in individual statements, add extra comments to the SQL files, ...

The beauty of being able to use your SQL files as-is is that you avoid lock-in. You can take your existing SQL files, start using Flyway with minimal investment and moved away later if it doesn't suit your needs anymore. Not so with Liquibase.

Also the issue of down migrations (think of them as compensating transactions, not rollbacks) is really something that sounds great in theory, but that is almost never needed in practice. See this old documentation page¹.

However when it comes down to using one or both, I certainly agree with SteveDonie (Liquibase team member) that using just one instead of the both together is almost always the better choice.

Disclaimer: I am Flyway's creator


¹ Though Flyway does support undo migrations nowadays, by reading the old documentation you'll understand the point Axel Fontaine is trying to make.

like image 107
Axel Fontaine Avatar answered Sep 30 '22 04:09

Axel Fontaine