Liquibase生成回滚SQL失败:无法找到已存在的vinit标签
Liquibase rollback-sql 找不到已存在标签的问题解决
问题详情
使用Liquibase 4.17.2生成数据库Schema,初始changelog内容如下:
<databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> <changeSet id="vinit" author="system"> <tagDatabase tag="vinit"/> </changeSet> </databaseChangeLog>
vinit标签已确认正确插入DATABASECHANGELOG表,但执行以下rollback-sql命令时:
liquibase --changelog-file=../../src/main/resources/db/changelog/changelog-master.xml --url=jdbc:oracle:thin:@localhost:1523:ORCL --username=zzz --password=xxx --output-file=afile.sql rollback-sql --tag=vinit
报错信息:
Unexpected error running Liquibase: Could not find tag 'vinit' in the database
尝试给标签名添加引号后问题依旧。环境为Docker容器中的Oracle 12c,update-sql功能正常,需求是生成回滚SQL。
解决方法
回滚失败的原因是rollback-sql命令中指定的--changelog-file路径,与DATABASECHANGELOG表中存储的changelog文件路径不匹配,只有当两者路径完全一致时,该命令才能正常生效。
内容的提问来源于stack exchange,提问作者adam pomari
相关产品推荐
相关产品推荐

