# preCondition onFail="CONTINUE"

**URL:** <https://forum.liquibase.org/t/precondition-onfail-continue/956>\
**Category:** General Discussion\
**Created:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956 "2010-11-30T02:42:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rimmeraj](https://avatars.discourse-cdn.com/v4/letter/r/8c91f0/32.png) [@rimmeraj](https://forum.liquibase.org/u/rimmeraj)\
**Post date:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956/1 "2010-11-30T02:42:00Z")

</div>

I am using 2.0 RC7 and have a precondition  
  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

on the command line I see

INFO: Continuing past: db-changes.xml::1::jason::(Checksum: 3:add56c0785f0c14a28c33161f288694b) despite precondition failure:  
&nbsp; &nbsp; &nbsp; 1 preconditions failed  
&nbsp; &nbsp; db-changes.xml : SQL Precondition failed.&nbsp; Expected ‘1’ got ‘0’

but it still runs my changes. I thought continue means skip and the next time I run it check again and see if it has become true.

Am I missing something?

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956/2 "2010-11-30T02:42:00Z")

</div>

Yes, continue means “continue on past this changeset but don’t mark it ran, so it will be re-evaluated on each update until it passes”.

It logs the precondition failure so you know about it, but should continue on.

Nathan

---

<div class="post-metadata">

**Author:** ![rbijkerk](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@rbijkerk](https://forum.liquibase.org/u/rbijkerk)\
**Post date:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956/3 "2010-11-30T02:42:00Z")

</div>

Hi Nathan,

Has this been identified as a bug for 2.0 RC7?

We are running into the same problem. Even though the precondition fails, the changeset is still running.

Regards,  
Ruud

---

<div class="post-metadata">

**Author:** ![ljnelson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ljnelson/32/120_2.png) [@ljnelson](https://forum.liquibase.org/u/ljnelson)\
**Post date:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956/4 "2010-11-30T02:42:00Z")

</div>

> _Originally posted by: rbijkerk_  
> We are running into the same problem. Even though the precondition fails, the changeset is still running.

Yes, but Nathan just said that CONTINUE, which if I am reading right is what you are using, is for the case when that’s exactly what you want.&nbsp; You clearly don’t want this behavior, so don’t use CONTINUE.

Or am I missing something?

Best,  
Laird

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956/5 "2010-11-30T02:42:00Z")

</div>

I did find the bug where it was executing onFail=CONTINUE changesets.&nbsp; It should now be following the documented behavior on [http://liquibase.org/manual/preconditions](http://liquibase.org/manual/preconditions) of:

HALT&nbsp; &nbsp; &nbsp; &nbsp; Immediately halt execution of entire change log [default] CONTINUE Skip over change set. Execution of change set will be attempted again on the next update. Continue with change log. MARK\_RAN Skip over change set, but mark it as ran. Continue with change log WARN&nbsp; &nbsp; &nbsp; &nbsp; Output warning and continue executing change set as normal. 

Nathan

---

<div class="post-metadata">

**Author:** ![svaret](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@svaret](https://forum.liquibase.org/u/svaret)\
**Post date:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956/6 "2010-11-30T02:42:00Z")

</div>

> _Originally posted by: Laird_  
> 
> > _Originally posted by: rbijkerk_  
> > We are running into the same problem. Even though the precondition fails, the changeset is still running.
> 
> Yes, but Nathan just said that CONTINUE, which if I am reading right is what you are using, is for the case when that’s exactly what you want.&nbsp; You clearly don’t want this behavior, so don’t use CONTINUE.
> 
> Or am I missing something?
> 
> Best,  
> Laird

As I understand it cotinued executing that same changeSet when it should continue with the next one, right?

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956/7 "2010-11-30T02:42:00Z")

</div>

If you have “CONTINUE” it will skip the failing changeset but continue with execution.&nbsp; “WARN” will execute the failing changeset and continue with execution.&nbsp; “MARK\_RAN” will skip the failing changeset like "CONTINUE does, but with the added feature of marking it as ran so liquibase will never attempt to run it again.

Nathan

---

<div class="post-metadata">

**Author:** ![un1402399586636r41id](https://avatars.discourse-cdn.com/v4/letter/u/59ef9b/32.png) [@un1402399586636r41id](https://forum.liquibase.org/u/un1402399586636r41id)\
**Post date:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956/8 "2010-11-30T02:42:00Z")

</div>

Why can’t CONTINUE be used for preConditions on changelogs?  
  
The documentations says explicitly “Outside a changeset (e.g. at the beginning of the change log), only HALT and WARN are possible values.”, but there is no explanation why.  
  
I would like to have a “master” changelog which includes other “sub-changelogs”. In these ones I would like to have a precondition check with CONTINUE or MARK\_RAN, so that a whole sub-changelog can be skipped. Writing the precondition in every changeset would be much more work and has the risk of forgetting it on a changeset.

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [November 30, 2010, 2:42am UTC](https://forum.liquibase.org/t/precondition-onfail-continue/956/9 "2010-11-30T02:42:00Z")

</div>

The reason is because preconditions on child changelogs are considered global to the entire changelog. There is a feature request in jira to support preconditions that cause the changelog it is in to be skipped, but the current functionality is that if a changelog has a top level precondition it is checked before anything is run, even changeSets in other changelogs.

Nathan
