I'm learning liquibase, I'm trying to write an sql changset that allows the possibility to rollback later on.
Here is my syntax:
--changeset me:1
create table DEPARTMENT (id SERIAL not null, name varchar(50) not null, person_id int, primary key (id), constraint person_foreign_key foreign key (person_id) references PERSON(id));
--rollback
drop table DEPARTMENT;
When running liquibase:update, the table department is created, but it is deleted by the second query. what is the correct syntax to have the rollback statement without the removal of the department table?
I'm using liquibise version 4.7.1
It seems that the drop statement should be on the same line as --rollback.
Here is the changeset file:
-- liquibase formatted sql
-- changeset me:1
create table DEPARTMENT (
id SERIAL not null,
name varchar(50) not null,
person_id int,
primary key (id),
constraint person_foreign_key foreign key (person_id) references PERSON(id)
);
--rollback drop table DEPARTMENT;