Using "runAlways" in Liquibase formatted sql file

I’m looking for some help to see if I am using the “runAlways” attribute correctly in a liquibase formatted sql file.


Version of Liquibase: 

Liquibase --version

Liquibase Version: 3.1.1



I am trying to drop a table and recreate it…so I have two change sets.


–liquibase formatted sql

–changeset sdt:001_01 runAlways=true

–preconditions onFail:CONTINUE

–precondition-sql-check expectedResult:1 SELECT COUNT(*) FROM all_objects WHERE object_name = ‘TEST_TABLE’ AND object_type = ‘TABLE’ AND owner = ‘SDT’


DROP TABLE sdt.test_table;


–changeset sdt:001_02 runAlways=true

–preconditions onFail:CONTINUE

–precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM all_objects WHERE object_name = ‘TEST_TABLE’ AND object_type = ‘TABLE’ AND owner = ‘SDT’


CREATE TABLE SDT.TEST_TABLE (id NUMBER, description VARCHAR2(255));


The purpose of this is to see if the “runAlways” tag is working when using Liquibase formatted SQL.

When I use Liquibase to run this sql, it will fail on the first change set because the precondition doesn’t pass. The second change set’s precondition will be met and so the test_table is created.


If I rerun this sql using Liquibase, the first change set will drop the table because the precondition will be met this time around. The second change set doesn’t get applied again however…so after this run…the test_table is unavailable.


When I rerun Liquibase, these change sets are ignored since they have been executed.


If I arrange this same test using the xml formatted changelogs, the “runAlways” attribute will function as expected. Am I using “runAlways” incorrectly with the liquibase formatted sql or is this attribute not supported?


It sounds like this attribute is supported based on this page: http://www.liquibase.org/documentation/sql_format.html


Is this a defect?


Thanks for your time.

This is not a defect. I see what I am doing incorrectly.


I am supposed to be using: <span. Now that I’ve made this change, the script is applied as expected.