liquibase: Regression 4.5.0 -> 4.6.1: valueBlobFile fails with "BLOB resource not found"
Environment
Liquibase Version: 4.6.1
Liquibase Integration & Version: Spring Boot 2.1.18.RELEASE
Database Vendor & Version: H2 1.4.200 (in-memory)
Operating System Type & Version: macOS Catalina (10.15.7)
Description
Spring Boot application can’t start and fails with an exception.
Steps To Reproduce
Run an application with ./mvnw spring-boot:run
Actual Behavior
liquibase.exception.MigrationFailedException: Migration failed for change set liquibase/version/0.4/2017-05-29--test_image.xml::add-test-image::php-coder:
Reason: liquibase.exception.DatabaseException: BLOB resource not found: /test/test.png
Expected/Desired Behavior
Migration should work as it worked before.
Additional Context
It has happened when I upgraded Liquibase from 4.5.0 to 4.6.1
Migration that has failed:
<changeSet id="add-test-image" author="php-coder" context="test-data">
<insert tableName="images_data">
<column name="image_id" valueNumeric="1" />
<column name="content" valueBlobFile="/test/test.png" />
</insert>
</changeSet>
The file it looks for (/test/test.png
) is here: src/main/resources/test/test.png
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 15 (2 by maintainers)
@famod said:
Yes, I agree. liquibase.util.file.FilenameUtils#concat()` in Liquibase 4.5.0 documents its contract:
The newer liquibase.util.FilenameUtil#concat() since Liquibase 4.6.0 does not document its contract and none of the tests use an absolute path for the second parameter, but the method behaves differently:
@nvoxland Could you please clarify if/how
liquibase.util.FilenameUtil#concat()
is intended to handle absolute paths for its second parameter?Good point if that’s the case (haven’t checked).
Btw, @php-coder I didn’t pay full attention to where your changelog file is located exactly. Since it’s located in
/src/main/resources/liquibase/version/0.4/
, you have to step up three levels:../../../test/test.png
But then again you probably don’t want to change your past changelogs anyway, right? 😉Workaround: prepend
..
! E.g.../foo.bar
or../db/foo.bar
. Or for your case @php-coder:../test/test.png
/cc @nvoxland