Wrong file name in changelog xml

Hello All,

I just observed that liquibase is not detecting the wrong file name provided in changelog xml.

e.g.

<?xml version="1.0" encoding="UTF-8"?>

<include file="abc/xyz"/>      

above abc folder has file xyz.sql but while passing in changelog xml .sql extension is not given. in this case liquibase is not throwing any error. how to catch this kind of error.

Hi @KapilGonjari ,

Liquibase calls out the changelog file that is mentioned in the liquibase.properties file. The property changeLogFile specifies the path to the changelog to execute. Check out this doc - Creating and Configuring Liquibase.Properties Files | Liquibase Docs

Hi @KapilGonjari

This is strange. Does liquibase still executes the SQL login from the file? If not then what exactly happens when you try this?

As you mentioned, liquibase doesn’t throw any error do you see anything else on console/ log file?

Also please help us with your environment details, just to reproduce this issue:

  1. DB you are using
  2. liquibase properties file
  3. Liquibase version

Thanks!
Rakhi Agrawal

@rakhi /@aditi

  1. Its Oracle DB and Liquibase-3.10.1

  2. I am using liquibase in Jenkins pipeline

  3. All liquibase properties like. DB connection,user name and pwd, etc are maintained in Jenkins configuration.

  4. I am passing the path of SQL files in changeLog xml as shown in my initial query.
    folder structure looks like.
    Jenkins_WorkSpace/sqlfiles/a.sql
    Jenkins_WorkSpace/changelogXML

  5. For above setting below is the path passed in changelog xml
    sqlfiles/a.sql

  6. Liquibase update works fine for above path

  7. Liquibase does not give any error if i miss the .sql extension while mentioning file path in changelog xml.
    e.g. sqlfiles/a.sql

Hope this is useful.

I have noticed a couple of examples of Liquibase skipping a changeset, without raising an error:

  1. As mentioned above, when the file extension is missing from an included filename:

  2. Liquibase formatted SQL: If a space exists in the changeset line (notice space after colon):
    –changeset author: grant_test_employee_privs

This is because liquibase takes the path as a directory path. So for example,

If I have used this

<include file="abc/xyz"/>   

then liquibase assumes it as a directory as it is not aware that xyz is going to be a file with whatever extension - .sql or .xml or .yml

yeah… right. These both points counts/sounds like an issue.

liquibase should prompt an error for these cases.

@KapilGonjari / @daryldoak : Would you guys mind logging an issue for respective cases tried here.

Thanks!
Rakhi Agrawal

Issue has been opened for my issue:

Great!
Let’s expect the fix in next release patch.

Thanks!