Adri
Adri

Reputation: 51

Execute liquibase update in production environment

I have a Java Maven project. I'm using liquibase to update DB.

Locally, to update my db, I just run in command line:

mvn liquibase:update

In production environment, I don't have Maven installed.

What I need to achieve is through console, execute a command to run the liquibase scripts in a specific classpath.

Any ideas?

Edit:

Ok.I'm trying to follow this approach. I put in a folder the following items:

  1. liquibase jar

  2. The war containing my application and the liquibase changesets

  3. liquibase.properties: It contains the following:

    url=jdbc:jtds:sqlserver://xxxxxxxx:xxxx/xxxxx

    username=xxx

    password=xxxxx

    classpath=war_file.war

    changeLogFile=WEB-INF/classes/sql/projectName/liquibase/liquibase.xml

Then, in a console, I execute:

java -jar liquibase-core-3.0.5.jar update

It works! It finds my liquibase.xml file and starts the liquibase update.

BUT, when it refers to liquibase.xml that are inside another jar file included in the lib, it fails, because I included it in the liquibase.xml as:

<include file="../other_module/src/main/resources/sql/projectName/liquibase/liquibase.xml" />

How can I add this "include" without doing "src/main/resources" and make it find this xml?

Upvotes: 5

Views: 6492

Answers (1)

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 77981

Running the updateSQL goal on your Dev machine:

mvn liquibase:updateSQL

You can generate a migration script:

└── target
    └── liquibase
        └── migrate.sql

This is one of my favourite features of liquibase. Sometimes clients insist that all database schema changes must be performed manually by their staff.

Another option is to build an auto-upgrade capability into your application. See the servlet listener

Upvotes: 4

Related Questions