executeCommand

The executeCommand Change Type executes a system command.

Note: Using Liquibase commands such as migrateSQL may not work as expected because the executeCommand Change Type doesn't generate SQL. To resolve this, use Change Types that generate SQL.

Uses

You can typically use the executeCommand Change Type to run a script using a specific executable. One reason to use executeCommand is to insert or update data.

Running the executeCommand Change Type

To run this Change Type, follow these steps:

  1. Add the Change Type to your changeset, as shown in the examples on this page.

  2. Specify any required attributes. Use the table on this page to see which ones your database requires.

  3. Deploy your changeset by running the update command:liquibase update

Available attributes

Name

Description

Required for

Supports

executable

The name of the executable to run

all

all

os

The list of operating systems on which to execute the command (taken from the os.name Java system property)

all

timeout

The timeout value for executable to run

all

Nested tags

Name

Description

Required for

Supports

Multiple allowed

args/arg

Arguments for the executable

all

yes

Nested property attributes

Name

Description

Required for

Supports

Multiple allowed

value

The value of the attribute (for example: '-param')

executeCommand examples

databaseChangeLog:
  - changeSet:
      id: executeCommand-example
      author: liquibase-docs
      changes:
        - executeCommand:
            args:
              - arg:
                  value: '-out'
              - arg:
                  value: '-param2'
            executable: mysqldump
            os: Windows 7
            timeout: 10s