the feature implemented to rollback to a different/previous changeset is working only if the referenced changeset and the changelog are present in the same folder level, is there a way that we can overcome this?
I need that rollback changeset and changelog to be present in a different folder. I use SQL formatted changelogs.
@atzawada can you help me with this please, if you can?
my rollback changeset and changelog are in a different folder or a sub directory to the actual changeset where the rollback is referenced from.
I got it to work, whether the changsets were in the same file, or in different files.
Here’s my “different files” example:
db-changelog1.sql:
--liquibase formatted sql
--changeset BOB:create_functionv1 endDelimiter:/ runOnChange:true
create or replace function test_func return date is
v_dummy1 date;
begin
select sysdate into v_dummy1 from dual;
return v_dummy1;
end test_func;
/
--rollback drop function test_func;
db-changelog2.sql:
--liquibase formatted sql
--changeset BOB:create_functionv2 endDelimiter:/ runOnChange:true
create or replace function test_func return date is
v_dummy1 date;
begin
select sysdate-1 into v_dummy1 from dual;
return v_dummy1;
end test_func;
/
--rollback changeSetId:create_functionv1 changeSetAuthor:BOB changeSetPath:db-changelog1.sql
Tried that, but it does not seem to be working. I will look if I can find a work around for it. Having rollback script in the same folder will make our repository messy.
Hey @daryldoak , I can’t seem to get it work. I tried all possible ways, It seems to work only when both changelogs are in the same folder level. Could you please show me how you did it?
--liquibase formatted sql
--changeset BOB:create_functionv1 endDelimiter:/ runOnChange:true
create or replace function test_func return date is
v_dummy1 date;
begin
select sysdate into v_dummy1 from dual;
return v_dummy1;
end test_func;
/
--rollback drop function test_func;
folder2/db-changelog2.sql:
--liquibase formatted sql
--changeset BOB:create_functionv2 endDelimiter:/ runOnChange:true
create or replace function test_func return date is
v_dummy1 date;
begin
select sysdate-1 into v_dummy1 from dual;
return v_dummy1;
end test_func;
/
--rollback changeSetId:create_functionv1 changeSetAuthor:BOB changeSetPath:folder1/db-changelog1.sql
The mistake I did was the file I was referring in the changSetPath was placed after the original changelog. which kept throwing the changeset not found error.
Changing my Changelog.xml to below, resolved the error: