【发布时间】:2016-11-27 17:29:05
【问题描述】:
我是 Liquibase 和 Flyway 的新手。正在尝试做一些Hello Worlds。我使用 Liquibase 和 Flyway 成功运行了基本 SQL(创建插入等)。有兴趣从 命令行 运行它们。
飞行路线:
- 有点容易上手
- 我必须将 sql 文件以正确的命名格式 'V1_xxxx.sql' 放入正确的文件夹 'flyway/sql' 并运行 'flyway migrate'
- 最好的部分是它自动拾取任何新的 sql 文件给定正确的文件名。
LiquiBase:
- 不得不花一些时间去理解和使用它
-
每次都需要给出正确的文件名
liquibase --driver=com.mysql.jdbc.Driver --classpath=/path/to/classes --changeLogFile=com/example/db.changelog1.xml --url= "jdbc:mysql://localhost/example" --username=dev 迁移
liquibase --driver=com.mysql.jdbc.Driver --classpath=/path/to/classes --changeLogFile=com/example/db.changelog2.xml --url= "jdbc:mysql://localhost/example" --username=dev 迁移
liquibase 有没有办法自动选择新的 xml 文件?像 Flyway 一样,我可以只给出文件夹名称,而 Liquibase 可以使用其表 DATABASECHANGELOG 来查找增量并执行相同的操作。
仅针对 Liquibase 的第二个问题
在 Windows 中,为了成功运行命令,我必须更改 changeLogFile 参数 ... 从 ...
liquibase --driver=com.mysql.jdbc.Driver --classpath=/path/to/classes --changeLogFile=com/example/db.changelog1.xml --url="jdbc:mysql://localhost/example" --username=dev migrate
到
liquibase --driver=com.mysql.jdbc.Driver --classpath=/path/to/classes --changeLogFile=./db.changelog1.xml --url="jdbc:mysql://localhost/example" --username=dev migrate
即我将当前工作目录更改为 com/example,然后修改 changeLogFile 参数以指向当前文件夹中的文件并执行命令。
有没有办法可以指向另一个文件夹中的changeLogFile(当前文件夹除外)
【问题讨论】: