基于爪哇的迁移在多个碎片上迁移
Followed this blog for creating simple java带有一个数据源连接的Flyway迁移。但是在应用程序中,我们将有多个碎片,并且可以选择迁移以在一个特定的碎片或所有碎片上运行。但是对于多个碎片,我们将拥有以下属性的不同值集,
flyway.url=jdbc:mysql://localhost/demo_database_1
flyway.user=root
flyway.password=
我们的应用程序迁移步骤(这些是带有飞行基础图像的Docker容器内部运行的手动步骤。这些步骤将在Docker内部顺序运行)
Demo_0 Shard Migration:demo_1 shard:
flyway -url='jdbc:mysql://localhost:3306/demo_0?useSSL=false&allowPublicKeyRetrieval=true' -user=root -password=root -locations=filesystem:./sql/global/migrations info
flyway -url='jdbc:mysql://localhost:3306/demo_0?useSSL=false&allowPublicKeyRetrieval=true' -user=root -password=root -validateOnMigrate="false" -locations=filesystem:./sql/global/migrations migrate
demo_1 shard迁移:
flyway -url='jdbc:mysql://localhost:3306/demo_1?useSSL=false&allowPublicKeyRetrieval=true' -user=root -password=root -locations=filesystem:./sql/data/migrations info
flyway -url='jdbc:mysql://localhost:3306/demo_1?useSSL=false&allowPublicKeyRetrieval=true' -user=root -password=root -validateOnMigrate="false" -locations=filesystem:./sql/data/migrations migrate
在飞行中有没有办法给出多个飞行网址迁移的方式? 基于SQL的迁移是否更好或基于Java的迁移?
Followed this blog for creating simple java based migrations in flyway with one datasource connection. But in application, we will be having multiple shards and have feasibility to choose migration to run on one particular shard or all shards. But for multiple shards , we will be having different set of values for the below properties
flyway.url=jdbc:mysql://localhost/demo_database_1
flyway.user=root
flyway.password=
Our application migration steps, ( these are manual steps running inside docker container with flyway base image. These steps will run sequentially inside docker )
DEMO_0 shard migration:
flyway -url='jdbc:mysql://localhost:3306/demo_0?useSSL=false&allowPublicKeyRetrieval=true' -user=root -password=root -locations=filesystem:./sql/global/migrations info
flyway -url='jdbc:mysql://localhost:3306/demo_0?useSSL=false&allowPublicKeyRetrieval=true' -user=root -password=root -validateOnMigrate="false" -locations=filesystem:./sql/global/migrations migrate
DEMO_1 shard migration:
flyway -url='jdbc:mysql://localhost:3306/demo_1?useSSL=false&allowPublicKeyRetrieval=true' -user=root -password=root -locations=filesystem:./sql/data/migrations info
flyway -url='jdbc:mysql://localhost:3306/demo_1?useSSL=false&allowPublicKeyRetrieval=true' -user=root -password=root -validateOnMigrate="false" -locations=filesystem:./sql/data/migrations migrate
Is there a way in flyway to give multiple flyway urls to migrate?
And also is SQL based migration is better or java based migration?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论