Skip to the content
Documentation

exp:expmigrationrollback

No ratings yet

Available since Exponential 6.0.15 (in development, not in a release yet).

Summary

Take migrations back: a run (its caption restored), one migration (its down()) or, for experts, any caption; a dry run unless --apply

Usage

./console exp:expmigrationrollback [options]
php bin/php/expmigrationrollback.php [options]
./console exp:migration:rollback [options]

Aliases

exp:migration:rollback

Help

The output of ./console help exp:expmigrationrollback (the script run with --help), without the standard options:

Usage: bin/php/expmigrationrollback.php [OPTION]... [TARGET]
Take migrations back
The argument names what to take back, found in this order:
  a run id         the caption taken before the run is restored (exp:upgrade's rollback: a safety
                   caption of the current state first, then database, storage and settings)
  a migration id   its down(), when it has one; the record of it is removed
  a caption id     any earlier caption, for experts: --expert --confirm=<the caption id>
Without --apply it lists what would be restored or undone. Oracle has no built-in restore: the
command prints the steps to restore by hand.

./console exp:migration:rollback 20261031-120000-a1b2c3
./console exp:migration:rollback 20261031-120000-a1b2c3 --apply
./console exp:migration:rollback 20261031120000_add_news_class --apply
./console exp:migration:rollback 2026-10-29_10-15-00 --expert --confirm=2026-10-29_10-15-00 --apply


Options:
  --apply              Make the changes (the default is a dry run that lists them and changes nothing)
  --dry-run            The default, accepted for scripts that pass it: list what would change, change nothing
  --format=VALUE       text (default) or json (the machine output exp-migration/1)
  --source=VALUE       The source: site or extension:<name> (generate: where the file goes; rollback: which migration, when two sources have its id)
  --environment=VALUE  The environment (default the installation's: [AdminEnvironment] Level, or EXP_ENV with Level=auto; check: every environment); only the migrations for it count
  --login=VALUE        Run as this user (default: [RunSettings] RunAsUser of migration.ini)
  --expert             Restore a caption that is not the one taken before a run (with --confirm)
  --confirm=VALUE      The id of the caption typed again, to restore it with --expert
  --parts=VALUE        Only these parts of the caption, a comma list of database, storage, settings, libraries, code (default [CaptionSettings] RestoreParts)
  --backup-dir=VALUE   Where the captions made without git_manager are (default var/backup/upgrade)
  --no-safety-caption  Restore without taking a caption of the current state first; refused on production without --force-no-caption
  --force-no-caption   With --no-safety-caption on a production installation: restore without a caption all the same
  --no-verify          Skip the verification after the restore
  --progress=VALUE     Append the progress of the run to this file, one JSON object per line (what the administration shows while the run goes on)

Options

Option Value Description
--apply - Make the changes (the default is a dry run that lists them and changes nothing)
--dry-run - The default, accepted for scripts that pass it: list what would change, change nothing
--format required text (default) or json (the machine output exp-migration/1)
--source required The source: site or extension:<name> (generate: where the file goes; rollback: which migration, when two sources have its id)
--environment required The environment (default the installation's: [AdminEnvironment] Level, or EXP_ENV with Level=auto; check: every environment); only the migrations for it count
--login required Run as this user (default: [RunSettings] RunAsUser of migration.ini)
--expert - Restore a caption that is not the one taken before a run (with --confirm)
--confirm required The id of the caption typed again, to restore it with --expert
--parts required Only these parts of the caption, a comma list of database, storage, settings, libraries, code (default [CaptionSettings] RestoreParts)
--backup-dir required Where the captions made without git_manager are (default var/backup/upgrade)
--no-safety-caption - Restore without taking a caption of the current state first; refused on production without --force-no-caption
--force-no-caption - With --no-safety-caption on a production installation: restore without a caption all the same
--no-verify - Skip the verification after the restore
--progress required Append the progress of the run to this file, one JSON object per line (what the administration shows while the run goes on)

Arguments

[target]

Standard options

Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.

Source

bin/php/expmigrationrollback.php, kernel/private/classes/commands/expmigrationrollback.php

See also

Generated example: exp:expmigrationrollback

Added to the reference for Exponential 6.0.15.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.