Database Liquibase命令行在sql中创建差异更改日志
实际上,我在windows上的命令行中使用了Liquibase,并尝试创建一个sql脚本来表示两个数据库之间的差异。不幸的是,我只得到xml文件作为回报。 你能帮我吗 我的命令行:Database Liquibase命令行在sql中创建差异更改日志,database,windows,command-line,liquibase,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:mys
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
我在另一个论坛上看到过类似的问题,但他没有得到一个好的答案()。
我还看到了一些从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>
提前感谢。您正在运行
diffChangeLog
命令,我想您需要diff
命令吗?请参见中的输出模式
diff命令仅提供差异的文本概述 要获取新(dev)数据库和旧数据库之间差异的SQL:
如果新的/dev数据库是您所期望的,那么您可以用代码提交新的变更日志。使用changelogSync使新的/dev数据库认为它已被liquibase更新。可能的重复项不正确。这个过程并不那么直接。没有生成符合SQL的代码,只有像@Ian Rogers所说的文本概述。
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