Des*_*xav 5 database windows command-line liquibase
我实际上在命令行的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
Run Code Online (Sandbox Code Playgroud)
我在其他论坛上看过这个类似的问题,但他没有得到一个好的答案(http://forum.liquibase.org/topic/convert-changelog-xml-file-into-sql-file).我还看到了一些从updateSQL cmd获取sql文件的参数,但从来没有看过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>
Run Code Online (Sandbox Code Playgroud)
谢谢你提前.
diff 命令仅提供差异的文本概述。
为了获得新(开发)和旧数据库差异的 SQL:
使用diffChangeLog通过比较两个数据库来(可能暂时)更新您的变更日志
对过时的数据库使用updateSQL以显示将运行以使其更新的 sql 命令。请注意,打印的 SQL 还将包含 liquibase 管理所需的命令。
如果 new/dev 数据库是您所期望的,那么您可以使用您的代码提交新的变更日志。使用 changelogSync 使 new/dev 数据库认为它已被 liquibase 更新。
您正在运行该diffChangeLog命令,我想您需要该diff命令吗?请参阅手册中的输出模式。
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
Run Code Online (Sandbox Code Playgroud)