Hi,
We’ve successfully been using Liquibase V3.6.3 for a while now for development of a new product that hasn’t gone into production yet and I’m currently investigating upgrading to V4.0.0 but I’m having a weird issue which is causing Liquibase runs to fail when trying to run with 4.0.0.
Our Liquibase scripts are all xml based and we have create table scripts, some sql scripts for triggers and some loadData scripts (using csv files) for loading test data for our dev and test environments. We’re currently using MySQL 5.7.
Everything worked fine for us in Liquibase 3.6.3 and I’ve also tried 3.10.2 and that worked fine as well, although I did have to tweak our csv files as we have columns in some tables that are nullable and when we were creating the csv files we just had no value at all for the nullable columns and that worked fine in 3.6.3, but 3.10.2 didn’t like it. So for example I changed from something like this:
ID,COLUMN_1,NULLABLE_COLUMN,COLUMN_2
1,Some text,,more text
to this:
ID,COLUMN_1,NULLABLE_COLUMN,COLUMN_2
1,Some text,NULL,more text
The problem that I’m having with 4.0.0 is that its complaining about one of our loadData scripts, its throwing this error:
Error setting up or running Liquibase:
[ERROR] liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/data/seed_data::filename::author:
[ERROR] Reason: liquibase.exception.DatabaseException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near csv data that its trying to insert
The weird thing is if I change the data that I have in the csv file (i.e. remove some rows of data) for the migration that its complaining about the error is still the same and shows that its still trying to insert the data that I actually removed from the csv file. So its almost like its trying to run a cached version of the file or its finding another version of the file from somewhere else.
I have tried setting relativeToChangelogFile=false and putting in the absolute file path and the script that it was complaining about then runs fine. However, this wouldn’t be any use for production, so its not a suitable solution.
So, I guess my question really is: have there been any changes in Liquibase 4.0.0 that affect how the relative paths work for accessing files for the loadData scripts?
I don’t really understand why Liquibase is finding a file with the same name but different file contents when I try to run with relativeToChangelogFile=true, but I can’t think of any other reason why this issue would be happening.
I saw this other post that seems to suggest a similar issue with relative paths, but there are no answers on that post: https://forum.liquibase.org/t/liquibase-v4-0-0-createprocedure-path-relativetochangelogfile/4627
I’d really appreciate any help anyone can give for this!
Cheers,
Dave