Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

LB 3.0.2 against DB2: Error with preConditions not tableExists

$
0
0
Hi all,
we have tested LB 3.0.2 (using Ant 1.8.2) with our scripts (in order to upgrade from LB 2.0.1) against DB2 v9.7.0.5 and found an error:

    <changeSet author="Author" id="changeSet.1">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists schemaName="${liquibase.schema}" tableName="TableA"/>
            </not>
        </preConditions>
    [...]
        <createTable schemaName="${liquibase.schema}" tableName="TableA">
            <column name="Column01" type="java.sql.Types.BIGINT">
                <constraints nullable="false"/>
            </column>
            <column name="Column02" type="java.sql.Types.BIGINT">
                <constraints nullable="false"/>
            </column>
            <column name="Column03" type="java.sql.Types.VARCHAR(100)">
                <constraints nullable="false"/>
            </column>
            <column name="Column04" type="java.sql.Types.VARCHAR(400)"/>
            <column name="Column05" type="java.sql.Types.BIGINT">
                <constraints nullable="false"/>
            </column>
        </createTable>
    [...]
    </changeSet>
    <changeSet author="Author" id="changeSet.2">
        <preConditions onFail="MARK_RAN">
            <not>
                <indexExists schemaName="${liquibase.schema}" indexName="IX_TableA"/>
            </not>
        </preConditions>
        <comment>META</comment>
        <createIndex schemaName="${liquibase.schema}" indexName="IX_TableA" tableName="TableA" unique="false">
            <column name="Column04"/>
            <column name="Column05"/>
        </createIndex>
    </changeSet>

[updateDatabase] INFO 01.08.13 14:41:liquibase: Reading from LB_TEST.DATABASECHANGELOG
[updateDatabase] INFO 01.08.13 14:41:liquibase: Marking ChangeSet: ./build/all-Structure-Init-Create.xml::changeSet.1::Author::(Checksum: 7:ecb0afc6682ca603f904ebfc4ef8eea3) ran despite precondition failure due to onFail='MARK_RAN': 
[updateDatabase]           ./build/sparda_meta-create_total.xml : Not precondition failed
[updateDatabase] SEVERE 01.08.13 14:41:liquibase: Change Set ./build/all-Structure-Init-Create.xml::changeSet.2::Author failed.  Error: Error executing SQL CREATE INDEX LB_TEST.IX_TableA ON LB_TEST.TableA(Column04, Column05): DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=LB_TEST.TableA, DRIVER=4.7.85
[updateDatabase] liquibase.exception.DatabaseException: Error executing SQL CREATE INDEX LB_TEST.IX_TableA ON LB_TEST.TableA(Column04, Column05): DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=LB_TEST.TableA, DRIVER=4.7.85

"SQLCODE=-204, SQLSTATE=42704, SQLERRMC=LB_TEST.TableA" means that DB2 is missing table LB_TEST.TableA.That is true because LB 3.0.2 scipped changeSet.1 due to precondition, and set it "MARK_RAN".

It seems that LB 3.0.2 does not recognise that table TableA is not existing in DB2 schema LB_TEST (== change log parameter ${liquibase.schema}), and therefore has to execute changeSet.1 (instead of setting it "MARK_RAN") while it gets the absence of index LB_TEST.IX_TableA, and tries to run changeSet.2.

This LB script works fine with LB LB 2.0.1.

Kind regards,
Frank

Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>