Deepesh Rathore
Deepesh Rathore

Reputation: 351

Liquibase is trying to execute change-set which has already been executed previously and thus throwing error that table already exist

    @Bean
    public SpringLiquibase liquibase()  {
        SpringLiquibase liquibase = new SpringLiquibase();
        liquibase.setDataSource(vsDataSource());        
        liquibase.setChangeLog("classpath:liquibase/avt_changelog_master.xml"); 
        return liquibase;
    }

This is how I am initializing liquibase through a spring boot application.

I have checked databasechangelog table and I can find that for that changeset entry is there and it has been executed successfully.

Why liquibase is not skipping that changeset and executing new unique changeset Ids.

Upvotes: 8

Views: 4366

Answers (1)

bilak
bilak

Reputation: 4966

Problem could be with name of your changelog. If you executed that changelog from within other application/maven/... and you didn't specified the logicalFilePath then liquibase could think of it as a different changelog. Try to set logicalFilePath in your changelog definition and try to execute it then.

this is example:

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"
                   logicalFilePath="db-changelog-master.xml">

Upvotes: 11

Related Questions