Vaibhav Gupta
Vaibhav Gupta

Reputation: 351

How to execute a single DB script multiple times in Liquibase?

I have a DB script (Generic GRANTS script) which should be run after every deployment. I want to run this script in the end every single time once my DB deployment is done. I tried using below code with runOnChnage indicator set to "true" but still no luck.

Please note that since this is a generic script, there is no change happening on this script and it should be run in the end of my deployment. Also, FYI please, I do have entries in the master changelog file to run my "all_time_release_changelog.xml" file

<changeSet context="all_time_release" id="Generic_Grants" author="TestUser" runOnChange="true">
    <sqlFile splitStatements="true" endDelimiter="/" path="src/main/sql/Grants/generic_grants.sql" />
</changeSet>

Am I missing any parameter here? Please help.

Upvotes: 1

Views: 1628

Answers (2)

Guillermo G
Guillermo G

Reputation: 46

You can also use runOrder = "last" to ensure it's the last file to execute.

Upvotes: 0

Logan Lim
Logan Lim

Reputation: 76

Try runAlways instead of runOnChange. This should run your script on each deployment.

Upvotes: 2

Related Questions