0
votes

I just begin with liquibase.

I find a lot of information with changelog in xml mode, but I want to (have to :( ) use SQL mode.

My problem :

I execute the following action:

liquibase --driver=oracle.jdbc.OracleDriver --url=jdbc:oracle:thin:@serveur:pour:BDD --username=cptoracle --password=mdporacle --changeLogFile=D:\Travail\liquibase\essais_changelog\ch3.sql update

Starting Liquibase at jeu., 08 ao¹t 2019 12:50:45 CEST (version 3.7.0 built at 2019-07-16 02:26:39)
Liquibase: Update has been successful.

ch3.sql :

--liquibase formatted sql

--changeset myname:1
create table me_tst2(
    id int primary key,
    name varchar(255)
);
--rollback drop table me_tst2;

--changeset myname:2
insert into me_tst2 (id, name) values (1, 'me 1');
insert into me_tst2 (id, name) values (2, 'me 2');

--changeset myname:3 dbms:oracle
create sequence me_seq2;
--rollback drop sequence me_seq2;

Now I want to test a rollback of the previous action.

How can I do it?

1

1 Answers

0
votes

I've found it !

first I must tag the previous version

liquibase --driver=oracle.jdbc.OracleDriver --url=jdbc:oracle:thin:@serveur:pour:BDD --username=cptoracle --password=mdporacle 
          --changeLogFile=D:\Travail\liquibase\essais_changelog\ch2.sql update tag=TAG01

then I execute

liquibase --driver=oracle.jdbc.OracleDriver --url=jdbc:oracle:thin:@serveur:pour:BDD --username=cptoracle --password=mdporacle 
          --changeLogFile=D:\Travail\liquibase\essais_changelog\ch3.sql update tag=TAG02

Then I can rollback the last sql:

liquibase --driver=oracle.jdbc.OracleDriver --url=jdbc:oracle:thin:@serveur:pour:BDD --username=cptoracle --password=mdporacle 
          --changeLogFile=D:\Travail\liquibase\essais_changelog\ch3.sql rollback TAG01