使用NodeJS运行Liquibase [英] Run Liquibase with NodeJS

查看:120
本文介绍了使用NodeJS运行Liquibase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用Liquibase进行自动数据库迁移.我了解Liquibase的基础知识,并且能够在命令提示符下运行它.我也想使这个过程自动化.我希望每当我的NodeJS项目启动时,Liquibase都可以运行.有帮助吗?

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?

推荐答案

使用 node-liquibase ,您已经可以做到这一点.

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));

这篇关于使用NodeJS运行Liquibase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆