Hi, all.
When executing the "updateTestingRollback" goal, is the precondition of a changeset evaluated just once (before the first update) or twice (before each of the two updates)?
Example
- <changeSet author="me" id="01">
- <preConditions onFail="MARK_RAN">
- <sqlCheck expectedResult="0">
- select count(*) from USERS WHERE ID = 1;
- </sqlCheck>
- </preConditions>
- <sql>
- INSERT INTO USERS VALUES (1, "JOHN", "SMITH", ....);
- INSERT INTO USERS VALUES (2, "MARY", "SHELLEY", ....);
- </sql>
- <rollback>
- DELETE FROM USERS WHERE ID = 2;
- </rollback>
- </changeSet>
First Update
Check if exists a record with ID = 1, if not exists then insert two rows
Rollback
Delete only the second row (the one with id =2)
Second Update
Is the precondition re-checked?
If so, the sql block is not called; otherwise it gets called, throwing an error (duplicated key).
I know that in this example i'm not doing right with the rollback (it shoould delete two rows), but please take it just as an example in order to have a confirmation about the way it's expected to work.