使用GitFlow开发模型管理Liquibase [英] Managing Liquibase with GitFlow development model

查看:150
本文介绍了使用GitFlow开发模型管理Liquibase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用git流模型进行开发,并尝试整合liquibase来高效管理数据库版本控制。问题出现在开发人员正在开发功能分支时,并且已经在其数据库和另一开发人员的数据库上执行了一个DB脚本,但它尚未成为任何发行版的一部分,因此尚未标记。现在,该功能已经过测试并成为发布的一部分,并且我们在变更集上标记并执行。



问题是如何回滚开发者机器上所做的更改,当脚本执行时没有定义标签,当我们尝试更新它时,当前标签将显示错误表已存在。



如何通过liquibase有效地管理这些条件?

解决方案

我们所做的并不是链接到Git或GitFlow,而是链接到数据库本身:

每次执行数据库脚本时,都会通过一个包装器完成,该包装器还会将所述脚本执行记录在数据库的专用表中。

这样,下一次应用相同的脚本时,包装器将检测到它已经被执行,并且不会再应用它。



这是一个实现什么是 pro像Flyway这样的管道已经(如此答案中所示,您可以同时使用:Liquidbase和Flyway ,它们似乎有所不同)。

问题是:这是无法单独使用版本控制系统:您需要额外的工具来执行/控制数据库升级过程。


We are using the git flow model for our development and trying to integrate liquibase for managing the database versioning efficiently. The problem comes when a developer is working on a feature branch and has made a DB script which is executed on his database and another developer's database, but it is not yet part of any release so it is not yet tagged. Now that feature is tested and becomes part of release and we tag the changeset and execute it on production.

The questions is how to rollback the changes made on the developer's machine because there was no tag defined at the moment when the script got executed and when we try to update it will the current tag it will show error "The table already exists".

How to manage these conditions through liquibase efficiently ?

解决方案

What we do is not linked to Git or GitFlow, but to the database itself:

Each time a db script is executed, it is done through a wrapper which will also record said script execution in a dedicated table of the database.
That way, next time that same script is applied, the wrapper will detect it was already executed, and won't apply it again.

This is an implementation of what a product like Flyway does already (as shown in this answer, you can use both: Liquidbase and Flyway, they seem to differ).
The point is: this is not manageable solely with a Version Control System: you need an additional tool to enforce/control the database upgrade process.

这篇关于使用GitFlow开发模型管理Liquibase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆