title: Liquibase contexts with Grails
body: <p>I am having a problem getting Liquibase changeset contexts to play nicely within my Grails application. I have a set of changesets that I would like to only run within a "test" context. However, they are executing every time. I think I have a configuration problem.</p>
  
  <p>The Liquibase documentation states that you just have to add the context="test" attribute to your changeSet. For my proof of concept test I am going to create an insert of a Patient record that I want to insert on Test, but not in my local Development environment. My changeset has the context added: </p>
  
  <pre><code>&lt;changeSet id="v1.1-garbage-1" author="Eric" context="test"&gt;
      &lt;insert tableName="patient"&gt;
          [...]
      &lt;/insert&gt;
  &lt;/changeSet&gt;
  </code></pre>
  
  <p>And then within my DataSource.groovy file I define my environments:</p>
  
  <pre><code>environments {
    development {
      dataSource {
          dbCreate = "create" 
          jndiName = "java:comp/env/jdbc/mydatabasename"
      }
    }
    test {
      dataSource {
          dbCreate = "create"
          url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
      }
    }
  [...]
  </code></pre>
  
  <p>So I have two environments, development and test. Then in my Config.groovy, I set up the Grails databasemigration plugin to only have the context "development" (for this proof of concept):</p>
  
  <pre><code>// Database Migration plugin
  grails.plugin.databasemigration.updateOnStart = true
  grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.xml']
  grails.plugin.databasemigration.autoMigrateScripts = ['RunApp', 'TestApp']
  grails.plugin.databasemigration.changelogFileName = "changelog.xml"
  grails.plugin.databasemigration.development.updateOnStartContexts = ['development']
  </code></pre>
  
  <p>In that final line, as I understand it, I am telling the databasemigration plugin to set the "development" contexts to 'development', thus when Liquibase executes, it should not run my changeset above, because it is defined within the 'test' context.</p>
  
  <p>Yet when I run the application, my changeset is executed. What have I bungled or missed in the setup?</p>