Search code examples
spring-bootliquibase

Spring Boot Liquibase Context not working


I am using Liquibase with SpringBoot and trying to run Changesets based on the spring profiles. When trying to use contexts in spring.liquibase.context, its ignored and the lquibase is running in every environment, Could someone please help?

my application-uat.yml:

spring:
  liquibase:
    enabled: true
    contexts: test

my changelog.yml:

  - changeSet:
      id: A2-44r-testing
      labels: A2-44
      author: me
      context: 'dev'
      comment: Liquibase DEV Connection
      failOnError: true
      runInTransaction: true
      changes:
        - sqlFile:

The context is ignored and the liquibase is running in the test environment. Should I do soemthingelse to stop liquibase from running in a specific environment?


Solution

  • As per the docs, its contextFilter for recent versions.

    "Note: Prior to Liquibase 4.16.0, the syntax to use in a changelog was context="test". In 4.16.0+, the correct syntax is contextFilter="test" to distinguish from the runtime argument. However, context is still a supported alias."

    https://docs.liquibase.com/concepts/changelogs/attributes/contexts.html