Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liquibase checksum validation failed

Tags:

liquibase

I am using Liquibase (3.5.1) in a Springboot application. I am using SQL based change log files. Adding new change-set ended up showing the check-sum validation error for the previous change-set.

Initial changelog file -

--liquibase formatted sql
--changeset tanmoy:1
create table serviceInstances (
    serviceId varchar(60),
    orgId  varchar(60),
    spaceId varchar(60),
    primary key (serviceId,orgId)
);

When added a new changeset like this -

--changeset tanmoy:2
create table serviceBindings (
    bindingId varchar(30) primary key,
    serviceId varchar(30),
    appId varchar(30),
    timeStamp BIGINT
);

the migration failed with this error logs -

Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          classpath:/db/changelog/db.changelog-master.sql::1::tanmoy was: 7:d15516f48de6531d1727cca8c56ec95a but is now: 7:3c7718f34f78701e0d2cadbf8278c1fa

    at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:266) ~[liquibase-core-3.5.1.jar:na]
    at liquibase.Liquibase.update(Liquibase.java:210) ~[liquibase-core-3.5.1.jar:na]
    at liquibase.Liquibase.update(Liquibase.java:192) ~[liquibase-core-3.5.1.jar:na]
    at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:434) ~[liquibase-core-3.5.1.jar:na]
    at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:391) ~[liquibase-core-3.5.1.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    ... 16 common frames omitted

Do not understand why the check-sum of the previous change-set is changed and not validated. Is it because I have added a new change-set to the change log file? If it is then how do I add new change set ?

like image 534
Tanmoy Avatar asked May 24 '16 08:05

Tanmoy


People also ask

How do I remove checksum error in Liquibase?

Running the clear-checksums command To run the clear-checksums command, specify the database driver, classpath, and URL the Liquibase properties file.

What is Liquibase checksum?

Liquibase uses a checksum to detect if your target database was updated. The checksum is computed after the parameters are applied. For example, let's say your target database already ran the following changeset: <changeSet id="1" author="example"> <addColumn tableName="my_table">

How does Liquibase Calculate md5sum?

When running the calculate-checksum command, the DATABASECHANGELOG table calculates an MD5 checksum for each entry based on the SQL script of the changeset. This checksum helps Liquibase detect differences between the changesets you want to deploy and the changesets that have already been run against the database.

What is changeset in Liquibase?

The changeset tag is a unit of change that Liquibase executes on a database and which is used to group database Liquibase Change Types together. A list of changes created by multiple changesets are tracked in a changelog.


1 Answers

On the level of the process, all the process is done incrementally. For example, when we create a table and want to make a change to the table, we give you a new incremental number. With this number, we determine the changes that we make in the one we create. It's like you're adding something new to your question. Therefore, you need to increase the id in your liquibase.xml file. If you have made changes to your present chart, do so as follows.

<changeSet id="73" author="fcelik">
    <comment>This change adds to customer_order table.</comment>
    <addColumn tableName="customer_order">
        <column name="owner_id" type="BIGINT">
            <constraints nullable="false"/>     
        </column>  
    </addColumn>
</changeSet>

Your file must be an unmatched value for your liquabase.xml. What you want to do between (usually the incremental path is tracked.) to create a file. For example, I have added a new column to the customer_order table here. Please note that <addColumn> when you use the tag.

like image 88
fatih Avatar answered Sep 19 '22 15:09

fatih