Using rollback with formatted SQL

Hello,


I am trying to test the rollback feature with formatted SQL. I am getting this error,


Liquibase Update Failed: rollbackSQL requires a rollback tag


Naturally, this being SQL, I do not have rollback tag, though, I do have rollback specfied (as suggested in the docs) as,


–rollback drop table my_table;


Would appreciate some advice.


Thanks

The rollback definition should look like this:


–changeset nvoxland:1

create table test1 (

  id int not null primary key,

  name varchar(255)

);


–rollback

delete from test1;

Hello, thanks for the reply.


I tried what you suggested. But If I put the rollback statement on it’s own (like you suggested), it’s being executed along with the main SQL.


So, If I had a file like this,


–liquibase formatted sql


–changeset change:1

create table table_1 (

    id int primary key,

    name varchar(255)

);


–rollback  

drop table table_1;



–changeset change:2

insert into table_1(id, name) values (1, ‘name 1’);

insert into table_1(id, name) values (2, ‘name 2’);


–rollback

delete from table_1 where id = 1;

delete from table_1 where id = 2;


The first changeset & rollback are executing one after the other and the change:2 set fails, as the previous rollback has dropped the table already.


Is my syntax wrong some where or am I missing a piece of config somewhere ?


Regards

Could you run with logLevel=debug and send the output?

Nathan