Git Product home page Git Product logo

Comments (6)

stevesaliman avatar stevesaliman commented on August 29, 2024 1

I'm not quite sure what you are asking. The plugin already supports the rollback task.

If the question is how to use the rollback task, you need to do two things.

  1. Add/configure a liquibase block in your build.gradle file. If you are already able to do a gradle update there is nothing else you need to do for rollback. If not, you need something like this:
liquibase {
  activities {
    main {
      changeLogFile 'src/main/db/changelogs.groovy'
      url 'jdbc:mysql://localhost:3306/my_db'
      username 'myusername'
      password 'mypassword'
    }
  }
}
  1. Call gradle with the following: gradle rollback -PliquibaseCommandValue=someTag where "someTag" is what you are trying to rollback to.

from liquibase-gradle-plugin.

eustimenko avatar eustimenko commented on August 29, 2024

I'd like to add rollbackCount parameter like at maven: <rollbackCount>1</rollbackCount>
I.e. at Gradle it should be
liquibase { activities { main { changeLogFile 'src/main/db/changelogs.groovy' url 'jdbc:mysql://localhost:3306/my_db' username 'myusername' password 'mypassword' rollbackCount 1 } } }
gradle rollback

from liquibase-gradle-plugin.

stevesaliman avatar stevesaliman commented on August 29, 2024

I think the maven plugin tries to combine a couple of Liquibase rollback type commands into a single command. In your case, I think gradle rollbackCount -PliquibaseCommandValue=1 should do the trick.

In general, the gradle plugin tries to be a simple pass through to Liquibase itself. Each command listed at http://www.liquibase.org/documentation/command_line.html becomes a Gradle task. Commands that take arguments (like rollback or tag) get them from the -PliquibaseCommandValue=myvalue, and parameters are part of the liquibase block.

The goal is to try and make the plugin easier to use by simply mirroring native Liquibase usage.

from liquibase-gradle-plugin.

eustimenko avatar eustimenko commented on August 29, 2024

@stevesaliman I like this plugin and would like to make it with some features for myself. Could you, please, help me with it? I need answer how to add parameter to activity that will be used by plugin such as username, url or password?

from liquibase-gradle-plugin.

stevesaliman avatar stevesaliman commented on August 29, 2024

Each parameter to an activity is handled by the methodMissing method of the org.liquibase.gradle.Activity class. It basically takes the method that was being called, along with its argument, and adds it to the list of parameters that will get passed to Liquibase itself when it is invoked. Any method you add to the Activity class would become a valid parameter to an activity. For example, you could define a method called rollbackCount to handle your use case, but that method would need to figure out how to convert that count into the right Liquibase argument.

from liquibase-gradle-plugin.

eustimenko avatar eustimenko commented on August 29, 2024

@stevesaliman Thank you.

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.