Adiee
Adiee

Reputation: 137

Run Liquibase with NodeJS

I just started automated database migrations using Liquibase. I understand the basics of Liquibase and I am able to run it using the command prompt. I want to automate this process also. I want Liquibase to run whenever my NodeJS project starts. Any Help?

Upvotes: 5

Views: 6598

Answers (1)

abenrob
abenrob

Reputation: 886

With node-liquibase, you can do this already.

const liquibase = require('liquibase');

liquibase({
  changeLogFile: 'resources/liquibase/db.changelog.xml',
  url: 'jdbc:postgresql://localhost:5432/postgres',
  username: 'postgres',
  password: 'admin'
})
.run('<action>', '<action-params>')
.then(() => console.log('success'))
.catch((err) => console.log('fail', err));

Upvotes: 5

Related Questions