0
votes

I have a situation to handle, i have my liquibase structured as per the best practices recommended. I have the change log xml structured as given below

Master XML 
  -->Release XML 
     -->Feature XML 
        -->changelog XML

In our application group, we run updateSQL to generate the consolidated sql file and get the changes executed through our DBA group.

However, the real problem I have is to execute a common set of sql statements during every iteration. Like

ALTER SESSION SET CURRENT_SCHEMA=APPLNSCHEMA 

as the DBA executes the changes as SYSTEM but the target schema is APPLNSCHEMA.

How to include such common repeating statements in Liquibase changelog.

3

3 Answers

1
votes

You would be able to write an extension (http://liquibase.org/extensions) that injects it in. If you need to do it per changeLog, it may work best to extend XMLChangeLogParser to automatically create and add a new changeSet that runs the needed SQL.

1
votes

You could make a changeSet with the attribute 'runAlways' set to true and include the SQL.

-1
votes

As far as I know, there isn't a way to have Liquibase itself do this. I suggest that you wrap Liquibase with your favorite scripting language such that you run a command "generateSQLforThoseCrazyDBAs" that runs Liquibase and then prepends the SQL you need to the output created by Liquibase.