Liquibase Custom SQL报告成功,但在Spring初始化期间回滚

时间:2013-11-21 15:49:04

标签: liquibase

我的Schema元素都已成功创建,但插入的数据不在单元测试结束时的表中,没有报告错误,但liquibase运行后数据不在表中。

<changeSet author="gbegley" id="load_default_tags" runAlways="true" failOnError="true">
    <sql>
        insert into po.tags (id,type,description) values (10,'Exclude','Hide Transactions')
    </sql>
</changeSet>

Liquibase输出以下内容

INFO 11/21/13 10:38 AM:liquibase: Successfully acquired change log lock
INFO 11/21/13 10:38 AM:liquibase: Reading from public.databasechangelog
INFO 11/21/13 10:38 AM:liquibase: Reading from public.databasechangelog
INFO 11/21/13 10:38 AM:liquibase: classpath:com/epacube/gpo/db/changelog/changelog.xml:     com/epacube/gpo/db/changelog/tags.xml::load_default_tags::gbegley: Custom SQL executed
INFO 11/21/13 10:38 AM:liquibase: classpath:com/epacube/gpo/db/changelog/changelog.xml:     com/epacube/gpo/db/changelog/tags.xml::load_default_tags::gbegley: ChangeSet com/epacube/gpo/db/changelog/tags.xml::load_default_tags::gbegley ran successfully in 3ms
INFO 11/21/13 10:38 AM:liquibase: Successfully released change log lock

然而

select * from po.tags

不返回任何结果。

我尝试使用“插入”元素,但看到相同的结果(报告成功,但没有数据)。

我从git hub中获取了lb3.07的源代码,然后使用调试器。观察liquibase springLiquibase bean,我的insert语句已经执行,并且在SpringLiquibase bean的初始化结束时在我的数据库表中可见(在SpringLiquibase #afterPropertiesSet完成之后)

但是,这一切都发生在我的junit测试的spring容器初始化期间。 Junit测试本身只运行一个断言,检查表是否为空,这是失败的。

这是使用spring 3.2.2和Junit 4.7对postgresql 9.3运行的liquibase 3.07版本

0 个答案:

没有答案
相关问题