我实际上在命令行中使用windows上的Liquibase,并尝试创建一个sql脚本来表示两个数据库之间的差异。不幸的是,我只能得到xml文件作为回报。你能帮我吗?
我的命令行:
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)。我还看到了一些用于从sql获取updateSQL文件的参数,但从未用于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>谢谢您的提前付款。
发布于 2013-10-09 00:51:53
您正在运行diffChangeLog命令,我想您需要diff命令?请参见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发布于 2014-06-03 19:51:03
diff命令仅提供差异的文本概述。
为了获得新(dev)和旧数据库的差异的SQL:
的liquibase所需的命令。
如果新的/dev数据库是您所期望的,那么可以将新的changelog与您的代码一起提交。使用changelogSync让新的/dev数据库认为它已经被liquibase更新了。
https://stackoverflow.com/questions/16943302
复制相似问题