Reputation: 137
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
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