Flyway and liquibase together? [closed]

浪子不回头ぞ 提交于 2019-12-30 00:28:27

问题


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.


回答1:


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 https://flywaydb.org/documentation/faq#downgrade

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




回答2:


I would never recommend using both tools at the same time. In my experience, even only one of them causes conflicts/collisions from time to time in a big distributed environments(over 5 teams with access to the same DB).

I will also give you a couple of pros and cons when it comes to running these tools in projects with big, distributed teams:

FlyWay:

Cons: Very strict when it comes to migration files changes. If someone checked in their migration file, it is not recommended to change it. It's like using force push in git in shared projects. Changing a migration(either its content or the file's name) will cause a migration failure on every machine that had the previous version of the file. The whole migration pack will need to be run from scratch. In some cases it can take a lot of time.

Pros: Well, what was described in Cons will, at the same time, build up a level of discipline. It might be a reasonable restriction when talking about introducing simultaneous changes by several teams to a production-running application.

Liquibase:

Cons: With a couple of tweaks should allow you to change the existing(applied) migrations. While it can be considered as a benefit, with a lot of people working on the same codebase, extra caution should be exercised. Flexibility comes at a price. It's easier to introduce some "regression" or inconsistency when such "git force push" style of changes is allowed for distributed projects.

Pros: More configurable and more flexible. Might include solutions for NoSql in the future. A couple of useful plugins(hibernate integration, for example).



来源:https://stackoverflow.com/questions/39044851/flyway-and-liquibase-together

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!