includeAll relativeToChangelogFile generates absolute path

Hi,

will setting up a project to use liquibase I ran into the following problem.

 

Assuming I have the following folder structure:

c:/dev/build.xml

          /database/master.xml
                          /views/vw_test1.sql

 

running my ant target containing:

<updateDatabase changeLogFile="./database/master.xml" outputFile=“database/update.sql” … />

 

and my master.xml containing following lines:


 

I get something like this in the update.sql file:

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, LIQUIBASE) VALUES (‘1’, ‘V_TEST1’, 'database/views/vw_test1.sql, SYSTIMESTAMP, 1, ‘7:b513b79544ee26790f2a234b20501bde’, ‘sql’, ‘’, ‘EXECUTED’, ‘3.0.7’);
INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, LIQUIBASE) VALUES (‘1’, ‘V_TEST1’, ‘C:/dev/./database/views/vw_test1.sq’, SYSTIMESTAMP, 2, ‘7:b513b79544ee26790f2a234b20501bde’, ‘sql’, ‘’, ‘EXECUTED’, ‘3.0.7’);

 

The problem with that is the if we rerun the same script from another path, it will reexecuted.

Not a problem for replaceable objects, but for inserts, etc… this is a huge problem

 

I’m using liquibase 3.0.7

 

PS: of course, I dont want to include one file explicitly and then reinclude it using the includeAll. It’s just for the exemple

I just made a test using version 2.0.5 and it was working better then.

 

The only difference was with

inlcudeFile -> ‘database/views/…’

includeAll  -> ‘./database/views/…’

 

At least you could run the same script from different locations/machines, you got the same path for the includeAll

Is your “.” directory in your updateDatabase classpath? It looks like Liquibase only can find the file using the filesystem-based locator which is trying to normalize the paths.


I created https://liquibase.jira.com/browse/CORE-1682 to look into it more, but it usually works best to make sure your files are in your classpath. Listing your base file as "<span may help as well too.


Nathan