如何解决flywaydb中脚本的版本号冲突问题

编程入门 行业动态 更新时间:2024-10-28 14:28:23
本文介绍了如何解决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)部署到生产环境时,脚本将不会执行,甚至会导致错误。

我应该如何做?谢谢!!

解决方案

有一个很棒的博文。

可以概括为:

  • 使用时间戳前缀您的迁移,而不是整数
  • 启用乱序迁移
  • 创建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:

  • Prefix your migrations with timestamps rather than integers
  • Enable out of order migrations
  • Create idempotent migrations
  • 更多推荐

    如何解决flywaydb中脚本的版本号冲突问题

    本文发布于:2023-11-16 06:32:11,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1601849.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:如何解决   版本号   脚本   冲突   flywaydb

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!