我实际上在 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)。
我还看到了一些用于从 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>
提前致谢。
diff 命令仅提供差异的文本概述。
为了获得新(dev)和旧数据库差异的 SQL:
Use 差异更改日志通过比较两个数据库(也许暂时)更新您的变更日志
Use 更新SQL针对过时的数据库,显示将运行以使其更新的 sql 命令。请注意,打印的 SQL 还将包含 liquibase 管理所需的命令。
如果 new/dev 数据库符合您的预期,您可以使用您的代码提交新的变更日志。使用changelogSync使new/dev数据库认为它已经被liquibase更新了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)