Search code examples
sqloracle-databaseliquibasechangelog

executing a common sql file using liquibase


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.


Solution

  • 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.