1
votes

I'm using liquibase version 3.4

After I execute a liquibase changeset, I see the following entry into the changelog

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE) VALUES ('1561715333', 'userx', 'C:/TeamCity.BuildAgent/work/CMSLiquibase/src/main/resources/releases/1/core/ddl/JIRA-1000-ADD_COLUMN.xml', SYSTIMESTAMP, 17, '7:762a7c8960445ef94da88c10a81acd79', 'addColumn', 'Adding column', 'EXECUTED', NULL, NULL, '3.4.0');

For filename, liquibase generates the full path "C:/TeamCity.BuildAgent/work/CMSLiquibase/src/main/resources/releases/1/core/ddl/JIRA-1000-ADD_COLUMN.xml" where as I want the relative path "src/main/resources/releases/1/core/ddl/JIRA-1000-ADD_COLUMN.xml"

The liquibase documentation says Filename should be "Path to the changelog. This may be an absolute path or a relative path depending on how the changelog was passed to Liquibase. For best results, it should be a relative path"

But I cannot find any code examples on where this has been configured.

Any idea where I can configure this?

1

1 Answers

2
votes

You can use the attribute logicalFilePath in the <databaseChangeLog> tag:

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"

    logicalFilePath="my_changelog.xml"> <<<<HERE

    ....
</databaseChangeLog>

Unfortunately there is no global setting to do that. You need to take care to do that for every changelog file you have.

Caution

If you change that if you have already run your existing change logs, you need to change the values in the database! Liquibase detects a changeset with the combination of filename, author and id. So if you change the logicalFilePath for something that has already been run, Liquibase will think it's a new change log and will try to run all changesets in the file again.