javapostgresqlspring-bootmavenliquibase

How to introduce liquibase in midle of spring boot maven based project


`I have already running project and trying to introduce liquibase in middle of project. This is spring boot maven based project.

I am following steps.

1.liquibase.properties

url=jdbc:postgresql://localhost:5432/cc
username=postgres
password=deadline123
driver=org.postgresql.Driver
outputChangeLogFile=src/main/resources/db/changelog/db.changelog-master.yaml
runOnChange=true
referenceUrl=jdbc:postgresql://localhost:5432/cc
referenceUsername=postgres
referencePassword=deadline123
changelogFile=src/main/resources/db/changelog/db.changelog-master.yaml
diffChangeLogFile=src/main/resources/diff.yaml
  1. Run command to generate changelog for current DB state mvn liquibase:generateChangeLog
  2. Then run command to sync changelog and create entry in DB mvn liquibase:changelogSync
  3. Starting my application but it's throwing error relation already exist. I can't figure out why liquibase is executing already executed changeset? I am using liquibase 4.6.3

Solution

  • Issue was with file path src/main/resources/db/changelog/db.changelog-master.yaml

    liquibase:changelogSync adds file path as above in log sync and liquibae on start actually takes classpath classpath:/db/changelog/db.changelog-master.yaml