liquibase-hibernate icon indicating copy to clipboard operation
liquibase-hibernate copied to clipboard

Unable to diff without a database

Open AlexCzar opened this issue 5 years ago • 2 comments

When there is no live database changelog diff cannot be generated (or documentation is missing). In our projects developers work with embedded h2 database while there is a production PostgreSQL database. We need to be able to generate diff between what we have in entities and what is already in the changelog. PostgreSQL is not accessible and application is not launched during changelog generation, so there is no h2. our setup is like this:

configure<LiquibaseExtension> {
  activities {
    register("main") {
      (arguments as MutableMap<String, String>).putAll(mapOf(
        "changeLogFile" to "src/main/resources/db/changelog/db.changelog-${project.name}.xml",
        "url" to "hibernate:spring:com.example.core.${project.name}?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
      ))
    }
  }
}

Initial changelog is generated successfully where changeLogFile points to, but then, after changes in code, I have no idea what I can set into referenceUrl to get the diff.

┆Issue is synchronized with this Jira Bug by Unito

AlexCzar avatar Oct 17 '19 15:10 AlexCzar

+1 It would be nice to have this feature

jayfray12 avatar Jul 20 '20 22:07 jayfray12

In the end we went with docker, basically we start the application with ddl-auto on a fresh postgresql docker image, and then diff against it. I still think resolving this issue would be useful though.

AlexCzar avatar Aug 11 '20 08:08 AlexCzar