Liquibase命令行在sql中创建diff changelog [英] Liquibase Command Line create diff changelog in sql
问题描述
我实际上在命令行中使用Liquibase在Windows上,我尝试创建一个表示两个数据库之间的差异的sql脚本。不幸的是,我只得到xml文件作为回报。
你能帮我吗?
I actually use Liquibase on windows in command lines, and I try to create an sql script that represent the diff between two databases. Unfortunatly I only get xml file in return. Can you help me ?
我的命令行:
liquidbase.bat
--driver=com.mysql.jdbc.Driver
--url=jdbc:mysql://localhost:3306/base1
--username=root
diffChangeLog
--referenceUrl=jdbc:mysql://localhost:3306/base2
--referenceUsername=root
> test.sql
我在另一个论坛上看到过类似的问题,但他没有好的答案( http://forum.liquibase.org/ topic / convert-changelog-xml-file-into-sql-file )。
我也看到一些参数从updateSQL cmd获取sql文件,但从来没有diffChangeLog。
I've seen this similar question in an other forum but he didn't got a good answer (http://forum.liquibase.org/topic/convert-changelog-xml-file-into-sql-file). I've also seen some parameters for getting sql file from updateSQL cmd, but never for a diffChangeLog.
xml反馈的例子:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<changeSet author="user (generated)" id="1370443156612-1">
<createTable tableName="test">
<column name="a" type="INT"/>
</createTable>
</changeSet>
<changeSet author="user (generated)" id="1370443156612-2">
<addColumn tableName="articles">
<column name="date_debut" type="TEXT">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
感谢提前。
推荐答案
您正在运行 diffChangeLog
命令,我想您想要 diff
命令?请参阅手册中的输出模式。
You're running the diffChangeLog
command, I think you want the diff
command? See Output Modes in the manual.
liquibase.bat
--driver=com.mysql.jdbc.Driver
--url=jdbc:mysql://localhost:3306/base1
--username=root
--referenceUrl=jdbc:mysql://localhost:3306/base2
--referenceUsername=root
diff
> test.sql
这篇关于Liquibase命令行在sql中创建diff changelog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!