I’m using the default Liquibase configuration coming with Spring Boot.
I have:
- a
changelog.xml
file insrc/main/resources/db/changelog
that works fine, - along with
url
,changeLogFile
,driver
,username
,password
properties inapplication.properties
, - and a Maven
pom.xml
having this for<dependency>
and<dependencyManagement>
:
<dependencies> ... <dependency> <groupId>org.liquibase</groupId> <artifactId>liquibase-core</artifactId> <scope>runtime</scope> </dependency> </dependencies> <build> <pluginManagement> <plugins> <plugin> <groupId>org.liquibase</groupId> <artifactId>liquibase-maven-plugin</artifactId> <configuration> <promptOnNonLocalDatabase>true</promptOnNonLocalDatabase> <propertyFile>${project.basedir}/../ApplicationMetierEtGestion/src/main/resources/application.properties</propertyFile> </configuration> </plugin> </plugins> </pluginManagement> </build>
Aside from the update of the database structure led by changelog.xml
that is working fine at development time, I would like Liquibase to generate also the related SQL files (by the mean of its updateSQL command).
This, because the next environments might not have Liquibase to handle the database updates.
How can I do that from here?
Advertisement
Answer
Liquibase has a goal that generates this SQL for you which is called updateSQL.
Have a look as it might be interesting in your case.
https://docs.liquibase.com/tools-integrations/maven/commands/maven-updatesql.html