auto-reorg parameter

The auto-reorg global parameter is a Boolean that determines whether Liquibase automatically reorganizes table objects stored on disk when you modify a DB2 database. The default value is true.

Uses

When you modify a table in your database, its indexes and data may not be stored in adjacent locations stored on disk, which wastes space.

To compact these table objects and eliminate fragmented data, DB2 databases require you to use the REORG TABLE command after you run statements like DROP COLUMN. By default, Liquibase adds all necessary REORG TABLE statements automatically.

If you want to handle database reorganization manually, or if you use an automated process that reorganizes your database separately from Liquibase, you can set auto-reorg to false.

Setting the auto-reorg parameter

You can set auto-reorg in four ways:

  • As a JVM system property
  • In your liquibase.properties file
  • As a global parameter in the CLI
  • As an environment variable (Liquibase Pro)

Java system property

You can set auto-reorg as a Java system property by using the JAVA_OPTS Environment Variable in your command line. The syntax on Mac/Linux is as follows:

JAVA_OPTS=-Dliquibase.autoReorg=<true|false> && liquibase update --changelog-file=dbchangelog.xml

The syntax on Windows requires the set command:

set JAVA_OPTS=-Dliquibase.autoReorg=<true|false> && liquibase update --changelog-file=dbchangelog.xml

liquibase.properties parameter

In Liquibase 4.1+, you can set auto-reorg by adding the following to your liquibase.properties file:

liquibase.autoReorg: <true|false>

CLI global parameter

You can use auto-reorg as a global parameter in your command line with a single Liquibase command, such as update:

liquibase --auto-reorg=<true|false> update --changelog-file=dbchangelog.xml

Environment variable (Liquibase Pro)

If you use Liquibase Pro, you can set auto-reorg as an environment variable. The syntax on Mac/Linux is as follows:

LIQUIBASE_AUTO_REORG=<true|false>

The syntax on Windows requires the set command:

set LIQUIBASE_AUTO_REORG=<true|false>

Note: The commands shown above only apply to the current shell. If you need to pass an environment variable to a child process without affecting the parent process, you can use the export command on Mac/Linux or the setx command on Windows.

Related links