sqlFile tag has no relativeToChangelogFile attribute

We have the following change-log setup. We have a master change-log. In this master change-log other change-logs are included with the include tag. The relativeToChangelogFile attribute of the include tag is set to true. Some of these change-logs use the sqlFile tag to include custom sql files.

This change-log setup is (also) used by a database-fill-(Java-)program. This program finds the master change-log on it’s class path. It then performs an update on a local database.

In this situation we have experience a problem with the sqlFile tags. The program is not able to find the referenced sql file. We have a work around for this problem. If we use classpath:// in the path the referenced file name can be found. The problem with this workaround is that it invalidates the change-log for command line use, without setting the class path.
We would like to use the same change-log in both situations, without having to change the class path.

So we have the following question. Why does the sqlFile tag does not support  relativeToChangelogFile tag?

It seems as do all the necessary code is in place to facilitate this use-case.

That is great news. I will look into the .xsd referenced in our xml files.

Thanks,
Daan

We are using dbchangelog-2.0.xsd as found on http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd. This xsd is different from the xsd as found at liquibase-core/src/main/resources/liquibase/parser/core/xml of the liquibase project. In particular, the latter xsd does have a relativeToChangelogFile attribute defined for the sqlFile element which the former xsd is missing.

So it seems as do the internet address points to an old xsd file.

kind regards,
Daan

There is a relativeToChangelogFile attribute on sqlFile.  You’ll want to make sure you are using the newest .xsd reference in your xml file.  I added it to the documentation page.

Nathan

Thanks, I updated the server.


Nathan

This appears to be an issue with YAML files as well? Regardless of what path I try I get
Unexpected error running Liquibase: - No path specified

I have


├── changelog-main.yaml
├── liquibase.properties
├── liquibase-system.properties
├── releases
│   └── 1.2.3
│       ├── 1.2.3.3.yaml
│       ├── file-rollback.sql
│       └── file.sql

main changelog includes releases

  - includeAll:
      path: releases
      relativeToChangelogFile: true

And my 1.2.3.3 changeset:

      changes:
        - sqlFile:
          splitStatements: true
          path: file.sql
          stripComments: true
          relativeToChangelogFile: true

I’ve tried every path combo I can think of??

I found a few open issues related to this so I’m not sure it’s still a problem?