onError/onFail preconditions flag not checked for changelog-wide preconditions

Description

From http://liquibase.org/forum/index.php?topic=72.0

I saw some forum posts related on this issue but I couldn't find a solution to my specific problem.

I'm using liquibase 1.9.3 in combination with an oracle XE 10 database.

The problem I have is that my complete migration is failing because 1 precondition is not met. I would like my migration to continue with the next files instead of completely failing.

According to the tutorial I found on working with an oracle database I'm trying the following scenario:

in my update.xml file I have:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
<include file="updates/v000/master.xml" />
<include file="updates/v001/master.xml" />
</databaseChangeLog>

and in v000\master.xml I added <changeSet author="MajorVersion" id="1" /> which is currently in my databasechangelog table

in both master.xml files I use a preCondition like this:
v000:
<preConditions onFail="WARN">
<!-- These changes should only be run against a schema with major version 0 -->
<sqlCheck expectedResult="0">
SELECT NVL(MAX(id),0)
FROM databasechangelog
WHERE author='MajorVersion'
</sqlCheck>
</preConditions>
and v001:
<preConditions onFail="WARN">
<!-- These changes should only be run against a schema with major version 1 -->
<sqlCheck expectedResult="1">
SELECT NVL(MAX(id),0)
FROM databasechangelog
WHERE author='MajorVersion'
</sqlCheck>
</preConditions>

when I run the update.xml I would expect that only the v001\master.xml is performed because the preCondition in v000\master.xml will evaluate to false. But instead I get:
Migration Failed: Validation Failed:
1 preconditions failed
update.xml : SQL Precondition failed. Expected '0' got '1'
. For more information, use the --logLevel flag)

Environment

None

Activity

Show:

Nathan Voxland July 9, 2009 at 4:37 PM

The problem is probalby that ValidatingVisitor.validate() needs to handle the onFail/onError attributes in the catch blocks.

Fixed

Details

Reporter

Fix versions

Affects versions

Priority

Created July 9, 2009 at 4:36 PM
Updated October 1, 2009 at 6:14 PM
Resolved October 1, 2009 at 6:14 PM