我正在将 Liquibase 与 SpringBoot 结合使用,并尝试基于 spring 配置文件运行变更集。当尝试在 spring.liquibase.context 中使用上下文时,它被忽略并且 lquibase 在每个环境中运行,有人可以帮忙吗?
我的应用程序-uat.yml:
spring:
liquibase:
enabled: true
contexts: test
我的变更日志.yml:
- changeSet:
id: A2-44r-testing
labels: A2-44
author: me
context: 'dev'
comment: Liquibase DEV Connection
failOnError: true
runInTransaction: true
changes:
- sqlFile:
上下文被忽略,liquibase 正在测试环境中运行。我应该采取其他措施来阻止 liquibase 在特定环境中运行吗?
由于 Yaml 的工作方式,更改集 Yaml 中的缩进问题可能会导致您观察到的行为。考虑到这一点,
comment
应该与context
处于同一级别,并且不嵌套在其中,否则,它将被误解为对象而不是字符串。
- changeSet:
id: A2-44r-testing
labels: A2-44
author: me
context: 'dev'
comment: Liquibase DEV Connection
failOnError: true
runInTransaction: true
changes:
- sqlFile: