I am using liquibase with spring boot. I am having SQL changesets. I have not changed anything in the liquibase SQL scripts. but I am getting below error
Error creating bean with name ‘liquibase’ defined in class path
resource: Invocation of init method failed; nested exception is
liquibase.exception.ValidationFailedException: Validation Failed:\r\n
1 change sets check sum\r\n
liquibase/db/0001_sample.sql::sample1_2::admin was:
8:600cf084d9c1ea85df2ddaa4f7a8a309 but is now:
8:47d241e6e1636203501ec72cafe4e5b6\r\n",
“class”: “org.springframework.beans.factory.BeanCreationException”,
I think this is due to formatting changing from my IDE to another ide. But I like to fix it. I am not looking for clearing checksum. Please suggest how to handle when using plain SQL with liquibase.
Note: I have seen examples with xml version, but I am looking for SQL with liquibase.
and then we use the schema/ folder to keep them organized. Don’t mind the xml suffixes, you can use sql files if you like. They are done in sequential order:
Schema change running for elk on Mon Apr 18 21:30:56 UTC 2022
[2022-04-18 21:31:03] INFO [liquibase.integration] No Liquibase Pro license key supplied. Please set liquibaseProLicenseKey on command line or in liquibase.properties to use Liquibase Pro features.
Liquibase Community 4.3.4 by Datical
####################################################
## _ _ _ _ ##
## | | (_) (_) | ##
## | | _ __ _ _ _ _| |__ __ _ ___ ___ ##
## | | | |/ _` | | | | | '_ \ / _` / __|/ _ \ ##
## | |___| | (_| | |_| | | |_) | (_| \__ \ __/ ##
## \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___| ##
## | | ##
## |_| ##
## ##
## Get documentation at docs.liquibase.com ##
## Get certified courses at learn.liquibase.com ##
## Free schema change activity reports at ##
## https://hub.liquibase.com ##
## ##
####################################################
Starting Liquibase at 21:31:03 (version 4.3.4 #55 built at 2021-04-19 20:18+0000)
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
[2022-04-18 21:31:06] INFO [liquibase.lockservice] Successfully acquired change log lock
[2022-04-18 21:31:07] INFO [liquibase.changelog] Reading resource: schema/221.xml
[2022-04-18 21:31:08] INFO [liquibase.changelog] Reading resource: schema/222.xml
[2022-04-18 21:31:08] INFO [liquibase.changelog] Reading from elk.DATABASECHANGELOG
[2022-04-18 21:31:09] INFO [liquibase.ext] Using percona toolkit: 3.3.0
[2022-04-18 21:31:09] INFO [liquibase.lockservice] Successfully released change log lock
[2022-04-18 21:31:09] INFO [liquibase.lockservice] Successfully acquired change log lock
Skipping auto-registration
[2022-04-18 21:31:09] WARNING [liquibase.hub] Skipping auto-registration
[2022-04-18 21:31:09] INFO [liquibase.changelog] Index ProductCodeText dropped from table linesum
[2022-04-18 21:31:09] INFO [liquibase.changelog] ChangeSet schema/221.xml::221-2::ekolp ran successfully in 66ms
[2022-04-18 21:31:09] INFO [liquibase.changelog] Columns created_at(DATETIME) added to member_custom_fields
[2022-04-18 21:31:09] INFO [liquibase.changelog] ChangeSet schema/222.xml::222-1::ekolp ran successfully in 95ms
[2022-04-18 21:31:09] INFO [liquibase.changelog] Columns updated_at(TIMESTAMP) added to member_custom_fields
[2022-04-18 21:31:09] INFO [liquibase.changelog] ChangeSet schema/222.xml::222-2::ekolp ran successfully in 73ms
[2022-04-18 21:31:09] INFO [liquibase.lockservice] Successfully released change log lock
Liquibase: Update has been successful.
I am getting below error without any changes in the sql file.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘liquibase’ defined in class path resource [//LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.ValidationFailedException: Validation Failed:\n 1 change sets check sum\n liquibase/db/0003_batch.xml::batch_1::admin was: 8:9c49637ad724b7ded237f91f8a567d0b but is now: 8:93aef70e06bda354629b39e6607fd363
I have seen it happen, not sure why. You have a few options:
run a “clear-checksums” command followed by and “update” command. This will clear all md5sums and recalculate them during the update, which will prevent the error.
No, clear-checksums is only for very specific scenarios. You want Liquibase to use the MD5SUM stored in the databasechangelog to determine if a changeset has been modified.
If you are getting the checksum error it indicates you have modified a changeset that Liquibase has already executed, which is an unexpected condition.