liquibase / liquibase-hibernate

Liquibase Hibernate Integration
Apache License 2.0
270 stars 154 forks source link

Unable to diff without a database #213

Open AlexCzar opened 4 years ago

AlexCzar commented 4 years ago

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

jayfray12 commented 4 years ago

+1 It would be nice to have this feature

AlexCzar commented 3 years ago

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.