Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Database Liquibase命令行在sql中创建差异更改日志_Database_Windows_Command Line_Liquibase - Fatal编程技术网

Database Liquibase命令行在sql中创建差异更改日志

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

实际上,我在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
我在另一个论坛上看到过类似的问题,但他没有得到一个好的答案()。 我还看到了一些从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:

  • 通过比较两个数据库,使用(可能暂时)更新您的变更日志

  • 针对过期数据库使用,以显示将运行以使其更新的sql命令。注意,打印的SQL还将包含liquibase管理所需的命令


  • 如果新的/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