modifyChangeSets
The modifyChangeSets
tag lets you include SQL scripts in your Liquibase changelog while using an application's native executor—like PSQL, SQL Plus, or SQLCMD—instead of the JDBC default— to deploy raw SQL scripts with a native executor. This removes the burden of converting raw SQL scripts into formatted SQL changelogs. You can use it to specify an overarching executor for all files in your project. It is available in Liquibase 4.18.0+.
Uses
If you have many changesets that need to be run with a native executor, and you organize your changelogs in a "root" and "nested" format using the include and includeAll tags, you can use the runWith attribute (PSQL, SQLPlus, or SQLCMD) to specify an executor that applies to every changeset in every file wrapped in the modifyChangeSets
tag. Since your nested changelogs inherit the executor specified in modifyChangeSets
, you don't have to specify it on each individual changeset you include.
Note: include
and includeAll
tags are available only in structured changelogs (XML, YAML, JSON). This is an existing limitation not introduced by modifyChangeSets
.
If you want to make an exception for a particular changeset you're including, you can specify the default Liquibase JDBC executor for that changeset. All other changesets still run with the executor inherited from modifyChangeSets
.
You can still include additional files in your root changelog outside of the modifyChangeSets
tag. These files run with the Liquibase JDBC executor.
Syntax
Attributes
Attribute | Value | Notes |
---|---|---|
runWith
|
jdbc
|
Default value if none specified. See Class JdbcExecutor. |
mongosh
|
Executor for MongoDB. See Using Liquibase with MongoDB Pro. | |
psql
|
Executor for PostgreSQL. See Use PSQL and runWith on PostgreSQL. | |
sqlplus
|
Executor for Oracle. See Use SQL Plus and runWith on Oracle Database and Use SQL Plus and Oracle Proxy User. | |
sqlcmd
|
Executor for MSSQL Server. See Use SQLCMD and runWith on Microsoft SQL Server. | |
<custom>
|
Custom executor. See Add a Native Executor. |
Nested tags
Name | Description | Required for | Supports |
---|---|---|---|
include
|
Includes the specified changelog | none | all |
includeAll
|
Includes the specified directory of changelogs | none | all |

<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
<modifyChangeSets runWith="sqlplus">
<include file="my/nested/changelog.xml" />
<includeAll path="release200/changelogs/sql" />
</modifyChangeSets>
<include file="sql/another.sql"/>
</databaseChangeLog>

databaseChangeLog:
- modifyChangeSets:
runWith: sqlplus
include:
- file: my/nested/changelog.xml
includeAll:
- path: release200/changelogs/sql
- include:
file: sql/another.sql

{
"databaseChangeLog": [
{
"modifyChangeSets": {
"runWith": "sqlplus",
"include": {"file": "my/nested/changelog.xml"},
"includeAll": {"path": "release200/changelogs/sql"}
},
"include": {"file": "sql/another.sql"}
}
]
}

XML
<modifyChangeSets runWith="psql">
<include file="my-psql-script.sql" relativeToChangelogFile="true"/>
</modifyChangeSets>
JSON
{
"databaseChangeLog": [
"modifyChangeSets":
{
"runWith": "psql",
"include": {"file": "my-psql-script.psql"},
"relativeToChangeLogFile": {"true"}
}
]
}
YAML
databaseChangeLog:
- modifyChangeSets:
- runWith: psql
- include:
file: my-psql-script.sql
relativeToChangelogFile: true

XML
<modifyChangeSets runWith="psql">
<includeAll path="raw-psql-scripts-directory"/>
</modifyChangeSets>
JSON
{
"databaseChangeLog": [
"modifyChangeSets":
{
"runWith": "psql",
"includeAll": {"path": "raw-psql-scripts-directory"}
}
]
}
YAML
databaseChangeLog:
- modifyChangeSets:
- runWith: psql
- includeAll:
path: /raw-psql-scripts-directory