Looking for feedback on the Formatted SQL Changelog Format

I am getting an exception with message: Error executing custom SQL [not required]

Basically for something like this:
–changeset xxxxxx
SQL
–rollback not required

–changeset yyyyy

Found the problem, patch has been submitted as CORE-691.  Included test case modifications.

Basically ‘not required’ was only being handled in the last changeset.

I now have a new problem with a NullpointerException in AfterTagChangeSetFilter.  It should not be as result of my patch.
Interesting enough all my changes were rolled back despite the exception if I can go by the Databasechangelog table being empty.

changeLogsAfterTag.contains(changeLogToString(changeSet.getId(), changeSet.getAuthor(), changeSet.getFilePath())) throws the exception.  changeLogsAfterTag can’t be null, so changeSet???

Is there any possibility of id, author or filepath not being set on these changesets?

Ok, testing shows the following.

I have 8 changesets in my database of which nr. 1 is an internal tag.  If I rollback to that tag, I want to rollback 7 changesets right?

So what I’m seeing is that in ChangeLogIterator.run, getChangeSets return 8 changesets, which is OK because as far as I know this should contain ALL changesets in the databasechangelog.

It seems though as if the internal liquibase tag (created doing liquibase.tag(xyz) ) and with new Liquibase (null, null, connection) is represented with a null ChangeSet instance?

Ok, think I’ve found the bug, will test and submit bug.  Basicially ChangeLogIterator is not checking if the getChangeSet returns null before adding the changeSet to the list of ChangeSets to ask filters for accept…

My fix would be to have ChangeLogIterator limit it to only the ones that can be found in the changeLog.  The filters work with all ran change lists so they will still check against whatever matches them on a large scale, but changeLogIterator will only pass in changesets from the current changeLog file to the filters for accept.

Patch has been submitted as CORE-693

Go figure Friday 13th and my formatted SQL file rollbacks works along with not required :slight_smile:

It looks like a good change, I applied it. 

Thanks for your help troubleshooting, and for the fixes

Nathan

Its a lot more fun to read Liquibase code and assist with patches than it is to do work :slight_smile:

I know the feeling…

Nathan

Guys, this change was applied 7 years ago. Why is it not in documentation?
http://www.liquibase.org/documentation/sql_format.html

The only way to find an answer was to use google :frowning: