Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

How to make sure at least one context is selected?

$
0
0
Hi all,

I have a changelog which adds partitioning to an Oracle table for non-XE databases and omits it otherwise (since Oracle does not allow partitioning for dev XE databases). In order to have modifySQL.append working I need to create a "nonXE" context.

The problem: the user might forget to put any context and run it against a prod database. In that case, it will still successfully execute, but with no partitions (which is bad).

Is there a simple way to require at least one context to be set when running a Liquibase build? I created a "hook", but it is more complex than it should be, and has to be included into every top-level changelog:
  1. <!-- trap to set a property if no contexts set. 
  2. Liquibase will run this nonexistent context only if no cotnexts are set.-->
  3. <property name="no_context" value="yes" context="no_context"/>
  4. <preConditions onFailMessage="Use either --contexts=xe or --contexts=nonxe" onFail="HALT">
  5.     <not>
  6.      <changeLogPropertyDefined property="no_context"/>
  7.     </not>
  8. </preConditions>



Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>