Git Product home page Git Product logo

Comments (1)

stevesaliman avatar stevesaliman commented on August 29, 2024 1

There are a couple of ways to tell Liquibase the default schema name you want. The plugin does it with a method in the activity of the liquibase block of build.gradle, where any method is assumed to be a command line argument to Liquibase. You can then use Gradle properties to alter the behavior from build to build.

If the default schema name is the same in all builds, you can use something like the following with no need for Gradle properties:

liquibase {
  activities {
    main {
      changeLogFile 'src/main/db/main.groovy'
      defaultSchemaName 'FOO'
      url project.ext.mainUrl
      username project.ext.username
      password project.ext.password
    }
  }
}

If the default schema name could change from build to build, you could invoke Gradle with -PdefaultSchemaName=FOO and use a liquibase block like this:

liquibase {
  activities {
    main {
      changeLogFile 'src/main/db/main.groovy'
      defaultSchemaName project.ext.defaultSchemaName
      url project.ext.mainUrl
      username project.ext.username
      password project.ext.password
    }
  }
}

If the option only needs to be there some of the time, you could do something like this:

liquibase {
  activities {
    main {
      changeLogFile 'src/main/db/main.groovy'
      url project.ext.mainUrl
      username project.ext.mainUsername
      password project.ext.mainPassword
      if ( project.ext.defaultSchemaName ) {
        defaultSchemaName project.ext.defaultSchemaName
      }
    }
  }
}

Then the schema name would only be sent to Liquibase when -PdefaultSchemaName=FOO was part of the Gradle command.

Note that the Gradle property can be named anything. You could use -PschemaName=FOO and it would work just fine as long as it matches the project.ext property used as the argument of the defaultSchemaName method of the activity.

from liquibase-gradle-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.