如何解决flywaydb中脚本的版本号冲突问题 [英] how to resolve version number conflicts of script in flywaydb

查看:1121
本文介绍了如何解决flywaydb中脚本的版本号冲突问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个git分支:develop,fixbug和master。

分支主机中最新的FlywayDB脚本版本是1.2.43,
,一个分支开发的是1.2.54。
分支fixbug的脚本版本更新到1.2.55,它基于分支master。



我需要将分支fixbug合并到分支master,并且首先将主版本(版本1.2.55)部署到生产环境。如我们所知,flywayDB按从低版本到高版本的顺序执行脚本。如果我这样做了,那么当我将分支开发(版本1.2.54)部署到生产环境时,脚本将不会执行,甚至会导致错误。



我应该如何做?谢谢!!

解决方案

有一个很棒的博文



可以概括为:


  1. 使用时间戳前缀您的迁移,而不是整数

  2. 启用乱序迁移

  3. 创建idempotent迁移


I got 3 git branches: develop, fixbug, and master.

The latest FlywayDB script version in branch master is 1.2.43, and the one in branch develop is 1.2.54. Branch fixbug's script version is update to 1.2.55, and it is based on branch master.

I need to merge branch fixbug to branch master, and to deploy master(version 1.2.55) to production environment first. As we know, flywayDB executes scripts in order, from low version to high version. If I do so, when I deploy branch develop(version 1.2.54) to the production evironment, the scripts will not be executed or even assert errors.

How should I do? Thanks!!

解决方案

There's a great blog post about that.

It can be summarised as:

  1. Prefix your migrations with timestamps rather than integers
  2. Enable out of order migrations
  3. Create idempotent migrations

这篇关于如何解决flywaydb中脚本的版本号冲突问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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