Liquibase:SQL不生成

时间:2015-08-11 20:37:51

标签: sql-server liquibase

我正在学习Liquibase。我正在努力尝试从我拥有的更改日志生成SQL。出于某种原因,它生成的唯一SQL是DATABASECHANGELOGLOCK表的锁定。

更新日志

这位于com / example / db / changelog中     

<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-3.1.xsd">

    <changeSet id="drop-tables" author="ascalonian">
        <dropTable tableName="liquibase" />
    </changeSet>

    <changeSet id="create-tables" author="ascalonian">
        <createTable tableName="liquibase">
            <column name="id" type="NUMERIC(19,0)" autoIncrement="true">
                <constraints primaryKey="true" nullable="false" />
            </column>
            <column name="firstname" type="VARCHAR(50)" />
            <column name="lastname" type="VARCHAR(50)">
                <constraints nullable="false" />
            </column>
        </createTable>
    </changeSet>

    <changeSet id="update-tables" author="ascalonian">
        <addColumn tableName="liquibase">
            <column name="username" type="VARCHAR(10)" />
        </addColumn>
    </changeSet>

</databaseChangeLog>

命令行

java -jar liquibase.jar 
--driver=net.sourceforge.jtds.jdbc.Driver 
--classpath=/Users/<username>/.m2/repository/net/sourceforge/jtds/jtds/1.3.1/jtds-1.3.1.jar 
--changeLogFile=com/example/db/changelog/db.changelog-master.xml 
--url=jdbc:jtds:sqlserver://localhost:1433/TestDB 
--username=username 
--password=password 
updateSQL

SQL输出

-- *********************************************************************
-- Update Database Script
-- *********************************************************************
-- Change Log: com/example/db/changelog/db.changelog-create.xml
-- Ran at: 8/11/15 4:28 PM
-- Against: username@jdbc:jtds:sqlserver://localhost:1433/TestDB
-- Liquibase version: 3.4.1
-- *********************************************************************

-- Lock Database
UPDATE [dbo].[DATABASECHANGELOGLOCK] SET [LOCKED] = 1, [LOCKEDBY] = 'fe80:0:0:0:541c:15ff:fe8f:7826%9 (fe80:0:0:0:541c:15ff:fe8f:7826%9)', [LOCKGRANTED] = '2015-08-11T16:28:18.090' WHERE [ID] = 1 AND [LOCKED] = 0
GO

-- Release Database Lock
UPDATE [dbo].[DATABASECHANGELOGLOCK] SET [LOCKED] = 0, [LOCKEDBY] = NULL, [LOCKGRANTED] = NULL WHERE [ID] = 1
GO

我期待SQL的删除,创建和更新表,但看不到任何东西。

Liquibase:版本3.4.1
数据库:MS SQL Server

1 个答案:

答案 0 :(得分:2)

无法重现您的问题。你已经运行了&#34;更新&#34;命令对你的数据库?这可以解释缺少SQL(因为更改已经应用于目标数据库)。

uses: IdHTTP, IdSSLOpenSSL; IdHTTP1 := TIdHTTP.create(nil); try IdHTTP1.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil); IdHTTP1.Request.Accept := 'text/html, */*'; IdHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0'; IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded'; IdHTTP1.HandleRedirects := True; IdHTTP1.get(FNomeArq,MS); Ms.Seek(0,soFromBeginning); header := IdHTTP1.Response.ContentType; except on E : EIdHTTPProtocolException do begin showmessage(intToStr(IdHTTP1.ResponseCode)); end; on E: EIdSocketError do begin showmessage(intToStr(IdHTTP1.ResponseCode)); end; on E: Exception do begin showmessage(intToStr(IdHTTP1.ResponseCode)); end; end; 表记录了已应用的更改集。签出rollbackSQL命令,它将显示撤消操作