Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validation Failed exception Liquibase

I am newbie in using liquibase for database management. I am getting the following error while doing mvn install. I am not able to know where exactly i went wrong. Could someone please help me with the solution

 Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
         1 changes have validation failures
              'sql' is required, db/changelog/changes/v0001.sql::raw::includeAll

db.changelog-master.yaml

databaseChangeLog:
    - includeAll:
        path: db/changelog/changes/

liquibase folder structure

like image 740
User2786 Avatar asked Feb 16 '18 05:02

User2786


People also ask

How are hash values used in Liquibase migration?

In liquibase whenever a migration is run it creates a hash value for each of the change log written in migration file. When the application is run for the first time entry is created for each change log with its hash values in the DatabaseChangelog Table.

How to make a change set passive in Liquibase?

You seem to have modified a liquibase changeset that has already been executed by Liquibase. Don't do that: revert to the previous version, and add a new changeset. Then add another changeSet (or task) transforming all the 0 in that column to 'ACTIVE', and all the 1 in that column to 'PASSIVE'.

Why do I get validation error when making changes to change log?

If a change is made to the existing change log which has been run once the hash value changes and a validation error is generated. To fix this issue you can revert the changes made to the change log after it was run for the first time and create a new change log to accommodate the change

What is the use of the VALIDATE command?

The validate command checks and identifies any possible errors in a changelog that may cause the update command to fail. Use the validate command to detect if there are any issues with a changelog before running the update command.


Video Answer


1 Answers

In liquibase whenever a migration is run it creates a hash value for each of the change log written in migration file. When the application is run for the first time entry is created for each change log with its hash values in the DatabaseChangelog Table.If a change is made to the existing change log which has been run once the hash value changes and a validation error is generated. To fix this issue

you can revert the changes made to the change log after it was run for the first time and create a new change log to accommodate the change

OR

delete the entries in the DatabaseChangeLog table for the particular change log giving error along with the change associated with the change log and rerun your migration.

like image 129
Deep Sodhi Avatar answered Sep 20 '22 13:09

Deep Sodhi