YAML格式的Liquibase alter Sequence抛出ValidationFailedException

时间:2019-05-15 13:56:14

标签: yaml liquibase database-versioning liquibase-hibernate liquibase-sql

我有一个liquiBase脚本来生成表格序列

db.changelog-initial-sequence.yaml

这里所有变更集都有一个ID,请参阅下文(YAML文件的某些部分) databaseChangeLog:

- changeSet:
    id: 1549954888334-1
    author: amit
    changes:
    - createSequence:
         sequenceName: ACTUAL_RESULT_CONTROL_SK_SEQ
         startValue: 43
         minValue: 1
         incrementBy: 1 
- changeSet:
    id: 1549954888334-2
    author: amit
    changes:
    - createSequence:
         sequenceName: ALIGNMENT_TYPE_SK_SEQ
         startValue: 6
         minValue: 1
         incrementBy: 1 

现在我们还没有向客户发布产品,但是我们已经进行了许多开发和测试,现在,我想将序列之一的起始值从1更改为10000,如果我在下面编写相同的代码:-

- changeSet:
    id: 1549954888334-11
    author: sas
    preConditions:
    - onFail: MARK_RAN
    - sequenceExists:
        sequenceName: source_master_sk_seq
    changes:
     - alterSequence:
         sequenceName: source_master_sk_seq
         startValue: 1000000
         minValue: 1
         incrementBy: 1

这将导致以下错误

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          db/changelog/db.changelog-initial-sequence.yaml::1549954888334-11::sas was: 7:eaebc24607a06eb812910d396381fa50 but is now: 7:e9d0bd6ec593872755ef1a47401da18d

我想要一个解决方案,可以在不删除Postgre SQL数据库的情况下更改顺序,因为这将导致测试数据的大量丢失。

0 个答案:

没有答案