0

Is it possible to create liquibase diff changelogs while comparing in-memory H2 database with a Hibernate? I'm using a gradle liquibase plugin with a following configuration:

liquibase {
    runList = project.ext["runList"]
    val today = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
    val changeLogFile = "src/main/resources/config/liquibase/changelog/${today}_changelog.xml"

    activities.register("h2") {

        this.arguments = mapOf(
            "url" to "jdbc:h2:mem:giskard_liquibase",
            "referenceUrl" to "hibernate:spring:com.example.domain?dialect=tech.jhipster.domain.util.FixedPostgreSQL10Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy",
            "classpath" to "$buildDir/classes/java/main",
            "changeLogFile" to changeLogFile,
            "logLevel" to "info",
        )
    }

What I'd like to compare while generating a diff file is:

Empty H2 + existing changelog vs current state of hibernate entities

for example if I have 2 entities in Java mapped to table A and B and there's an existing changelog that creates table A, then after running diff-changelog there'd be a new changelog file with only table B.

andreybavt
  • 1,301
  • 4
  • 17
  • 32

0 Answers0