1

I've been googling for hours but it doesn't seems to exist another way to create liquibase changelog files but by hand.

Isn't there any tools or command lines to automate the creation of changelog files ? I'm using JHipster that is correctly creating changelogs for new entities but as stated here, JHipster won't generate new changelogs for updated entites, so I was wondering if their was any kind of tool to generate additional changelogs? Actually I'm creating changelogs by writing xml files by hand and it doesn't seems super efficient.

Thank you for reading.

MHogge
  • 5,408
  • 15
  • 61
  • 104
  • 1
    There is a maven plugin that helps you to generate the changelog. Have you tried that? – Ali Aug 21 '19 at 08:45
  • Do you have a link and/or an example of how to use it? Thanks. – MHogge Aug 21 '19 at 08:57
  • You can take a look at this example: https://www.baeldung.com/liquibase-refactor-schema-of-java-app – Ali Aug 21 '19 at 09:14
  • 1
    The maven plugin for liquibase is included in generated pom.xml. See official doc: https://www.jhipster.tech/development/#database-updates-with-the-maven-liquibasediff-goal – Gaël Marziou Aug 21 '19 at 12:54

1 Answers1

0

You can try to generate a changelog from your JPA entities and then add them to your changelog selectively as described here where you can find an example on how to generate changelogs from jpa entities.

Another technique could be to generate your jpa entities automatically in your database using spring.jpa.hibernate.ddl-auto=update and then generate your liquibase changelog to export the current database state and then add selectively new entities to your applicaton changelog.

You can also generate liquibase changelog using a database with tables previously created.

liquibase --driver=driver.jdbc.Class \
     --classpath=/path/to/drivers/lib/driver.jdbc.jar \
     --changeLogFile=liquibase-changelog.xml \ 
     --url="jdbc:url:thin:@192.168.1.100:1525:path" \
     --username=USER \
     --password=PASS \
     --logLevel=debug \
     generateChangeLog
ValerioMC
  • 2,926
  • 13
  • 24