CLI - Operations

# migrate all

Execute all the pending changeUnits, as the standard Mongock migration process.

$ ./mongock migrate all -aj <APP_JAR>
Name CLI Parameter Type Description Mandatory
APP_JAR -aj String It's the path to your executable uber JAR. YES

migrate all output

# migrate up-to-change PRO

Execute the pending changeUnits until the specified CHANGE_UNIT_ID (included), as the standard Mongock migration process.

$ ./mongock migrate up-to-change <CHANGE_UNIT_ID> -aj <APP_JAR>
Name CLI Parameter Type Description Mandatory
CHANGE_UNIT_ID N/A String It's the change identifier used in your @ChangeUnit annotation YES
APP_JAR -aj String It's the path to you executable uber JAR. YES

migrate all output

# undo all PRO

Reverts all the changeUnits.

This operation uses the methods annotated with @RollbackExecution and @RollbackBeforeExecution in the changeUnits.

$ ./mongock undo all -aj <APP_JAR>
Name CLI Parameter Type Description Mandatory
APP_JAR -aj String It's the path to your executable uber JAR. YES

migrate all output

# undo up-to-change PRO

Reverts all the changeUnits until the specified CHANGE_UNIT_ID (included).

This operation uses the methods annotated with @RollbackExecution and @RollbackBeforeExecution in the changeUnits.

$ ./mongock undo up-to-change <CHANGE_UNIT_ID> -aj <APP_JAR>
Name CLI Parameter Type Description Mandatory
CHANGE_UNIT_ID N/A String It's the change identifier used in your @ChangeUnit annotation YES
APP_JAR -aj String It's the path to you executable uber JAR. YES

migrate all output

# state db PRO

Show the current state of changes.

$ ./mongock state db -aj <APP_JAR>
Name CLI Parameter Type Description Mandatory
APP_JAR -aj String It's the path to your executable uber JAR. YES

migrate all output

# state code-base PRO

List the existing code changeUnits and their current state.

$ ./mongock state code-base -aj <APP_JAR>
Name CLI Parameter Type Description Mandatory
APP_JAR -aj String It's the path to your executable uber JAR. YES

migrate all output

# state compare PRO

Compare the existing code changeUnits with the current state of changes.

$ ./mongock state compare -aj <APP_JAR>
Name CLI Parameter Type Description Mandatory
APP_JAR -aj String It's the path to your executable uber JAR. YES

migrate all output