liquibase的新手.我有一个由休眠管理的现有架构.现在,我需要删除一些表,并且正在使用liquibase.我编写了一个配置,成功删除了表.
New to liquibase. I have an existing schema managed by hibernate. I now need to remove some tables and I'm using liquibase. I wrote a config that succesfully deletes the table.
但是我希望仅在表存在的情况下运行检查,因为系统的新安装将没有该表,因为休眠映射对象不再存在.
But I want the check to run only if the table exists, since a new install of the system would not have the table since the hibernate mapping objects no longer exist.
我试图添加一个前提条件.但是,我的日志仍然表明liquibase正在失败,因为它试图删除该表并且该表不存在.我做错了什么?我正在使用Spring Boot/Java
I attempted to add a precondition. However, my logs still indicating that liquibase is failling becuase it tries to delete the table and it doesn't exist. What am I not doing correctly? I'm using Spring Boot / Java
databaseChangeLog: - preConditions: on-fail: mark_ran on-error: mark_ran tableExists: tableName: some_old_table schemaName: public - changeSet: id: 01_del_old_table author: some-dev-01 comment: Remove old table changes: - dropTable: tableName: some_old_table日志错误:表public.some_old_table不存在 ...
error in log: Table public.some_old_table does not exist ...
PreconditionFailedException这就像ti正在检查先决条件...仍然无法通过.
It's like ti's checking the preconditions... and still failing them.
也尝试过
databaseChangeLog: - changeSet: id: zzchange-1.0-remove-xczczxc author: zzzz comment: Remove some_old_table table - no longer needed preConditions: on-fail: mark_ran tableExists: tableName: some_old_table changes: - dropTable: tableName: some_old_table推荐答案
问题在于on-fail属性没有正确拼写. on-fail应该为onFail.
The issue was in the on-fail attribute not being spelled correctly. on-fail should be onFail.
正如@Julian所提到的,最好将范围限定为特定变更集的前提作为前提,并且注释应该放在preCondition之后,尽管这不是手头的问题.
As @Julian mentioned, it's best to put a precondition scoped to a specific change set, and the comment should go after a preCondition, although that was not the issue at hand here.
databaseChangeLog: - changeSet: id: zzchange-1.0-remove-xczczxc author: zzzz preConditions: on-fail: mark_ran tableExists: tableName: some_old_table comment: Remove some_old_table table - no longer needed changes: - dropTable: tableName: some_old_table更多推荐
如果表存在则跳过liquibase更改
发布评论