A new topic, 'Bug/inconvenience in preConditions', has been made on a board you 
are watching.

You can see it at
http://liquibase.org/forum/index.php?topic=119.new#new

The text of the topic is shown below:

When a preConditions is attached to a changeSet in will not be evaluated until 
the migrator gets to that particular changeset, 
but if the same preConditions is attached to a changelog it will be evaluated 
before any migration.
That is a problem because the changelog can be executed from an include, but 
still it is evaluated before any prior includes are executed.

All_Refactorings.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<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="Refactoring_1.xml" />
    <include file="Refactoring_2.xml" />
    
</databaseChangeLog>


Refactoring_1.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<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";>
  
    <changeSet id="2009-05-22_1" author="Claus J.O. Justesen">
        <!-- do something -->
    </changeSet>
  
</databaseChangeLog>


Example 1: preConditions attached to a changeSet
Refactoring_2.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<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";>

    <changeSet id="2009-08-10_1" author="Claus J.O. Justesen">
        <preConditions onFail="HALT">
            <changeSetExecuted id="2009-05-22_1" author="Claus J.O. Justesen" 
changeLogFile="Refactoring_1.xml" />
            </preConditions>
        <!-- do something -->
    </changeSet>

    <changeSet id="2009-08-10_2" author="Claus J.O. Justesen">
        <preConditions onFail="HALT">
            <changeSetExecuted id="2009-08-10_1" author="Claus J.O. Justesen" 
changeLogFile="Refactoring_2.xml" />
            </preConditions>
        <!-- do something -->
    </changeSet>

</databaseChangeLog>


Executing All_Refactorings will be succesfull both if Refactoring_1 is already 
executed before and if Refactoring_1 is not executed before and should 
therefore be executed in this migration.

Example 2: preConditions attached to a changelog
Refactoring_2.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<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";>

    <preConditions onFail="HALT">
        <changeSetExecuted id="2009-05-22_1" author="Claus J.O. Justesen" 
changeLogFile="Refactoring_1.xml" />
    </preConditions>

    <changeSet id="2009-08-10_1" author="Claus J.O. Justesen">
        <!-- do something -->
    </changeSet>

    <changeSet id="2009-08-10_2" author="Claus J.O. Justesen">
        <preConditions onFail="HALT">
            <changeSetExecuted id="2009-08-10_1" author="Claus J.O. Justesen" 
changeLogFile="Refactoring_2.xml" />
            </preConditions>
        <!-- do something -->
    </changeSet>

</databaseChangeLog>


Executing All_Refactorings will be succesfull if Refactoring_1 is already 
executed before, but will fail if Refactoring_1 is not executed before and 
should therefore be executed in this migration.

This makes preConditions attached to changelogs pritty unusable at the moment.

Unsubscribe to new topics from this board by clicking here: 
http://liquibase.org/forum/index.php?action=notifyboard;board=1.0

Regards,
The LiquiBase Community Forum Team.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Liquibase-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/liquibase-user

Reply via email to