liquibase / liquibase-oracle

Liquibase extension to add improved Oracle support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can we use xinclude in Liquibase XML changlelog?

Umartahir93 opened this issue · comments

I am trying to include another xml file which is a fragement of XML file into my changelog. Whenever I execute my changelog in liquibase it gets executed successfully (without any parsing error) but no table is created in the database.

I am not sure we can use xInclude in liquibsae, but I think it should be possible as we are using xml underneath in liquibase. Plus I coulndt find any example of xinclude in liquibase and in offical documentation.

Changelog.xml

<?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.8.xsd"
                       xmlns:xi="http://www.w3c.org/2001/Xinclude">

	<changeSet id="id-1234"
		author="umarTahir">

		<comment>creates table: employee</comment>
		<xi:include
			href="employee.xml" parse="xml"
         xpointer="title"/>

		<rollback>
			<dropTable schemaName="employee_test" tableName="employee" />
		</rollback>
	</changeSet>

</databaseChangeLog>

employee.xml

<createTable tableName="employee" xml:id="title">
	<column name="employee_id" type="UUID">
		<constraints primaryKey="true"
			primaryKeyName="employee_pkey" />
	</column>
	<column name="first_name" type="TEXT" />
	<column name="middle_name" type="TEXT" />
	<column name="last_name" type="TEXT" />
	<column name="email" type="TEXT" />
	<column name="n_created_by" type="TEXT" />
	<column name="n_created" type="TIMESTAMP WITHOUT TIME ZONE" />
	<column name="n_last_modified_by" type="TEXT" />
	<column name="n_last_modified"
		type="TIMESTAMP WITHOUT TIME ZONE" />
</createTable>

┆Issue is synchronized with this Jira Bug by Unito