-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
I'm facing an issue with quarkus-liquibase, particularly with the XML Changelog.
I noticed an issue on GitHub, which can be found at https://github.com/quarkusio/quarkus/issues/27437, opened in 2022.
Configuration:
quarkus.liquibase.enabled=true
quarkus.liquibase.migrate-at-start=true
quarkus.liquibase.change-log=db/postgres/changelog-master.yml
files : https://github.com/RafiIsaharov/esb-infra/tree/main/src/main/resources/db/postgres
Snapshot of changelog-master.yml:
databaseChangeLog:
- include:
file: db/postgres/changelog.001.sql
- include:
file: db/postgres/changelog.002.xml
- include:
file: db/postgres/changelog.003.sql
- include:
file: db/postgres/changelog.004.sql
Snapshot of changelog.002.xml:
<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 https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
<!--changeSet id="1" author="rafi.isaharov">
<sql>
ALTER TABLE routes ADD COLUMN timestamp TIMESTAMP;
</sql>
</changeSet-->
<!--changeSet id="2" author="rafi.isaharov">
<sql>
ALTER TABLE routes ALTER COLUMN timestamp SET DEFAULT NOW();
</sql>
</changeSet-->
<changeSet id="3" author="rafi.isaharov">
<sql splitStatements="false">
<![CDATA[
-- Create a function to update timestamp on every update
CREATE OR REPLACE FUNCTION update_timestamp()
RETURNS TRIGGER AS $$
BEGIN
NEW.timestamp = NOW();
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
]]>
</sql>
</changeSet>
<changeSet id="4" author="rafi.isaharov">
<sql splitStatements="false">
<![CDATA[
-- Create a trigger to execute update_timestamp function on every update
CREATE TRIGGER update_routes_timestamp
BEFORE UPDATE ON routes
FOR EACH ROW
EXECUTE FUNCTION update_timestamp();
]]>
</sql>
</changeSet>
Error Trace:
exception_liquibase_using_changelog_as_xml.txt
Observations:
-
This issue occurs only in the native image, not when running the runnable jar.
-
The application fails to start with this error.
-
Quarkus version: 3.12.3
-
Java version: 17.0.11+7-LTS, vendor version: Oracle GraalVM 17.0.11+7.1
-
Apache Maven 3.9.6
Current Workaround:
To overcome the issue with the XML changelog file, I am converting it into an equivalent SQL file format.
Reproduce the issue:
I've uploaded the code to my GitHub repository, which includes the docker-compose.yaml file for the Postgres database.
You can download and replicate it from the main branch https://github.com/RafiIsaharov/esb-infra.git.