Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Migration commands

Every exp:migration command in one table - what it does, when to use it, its most used options and a link to its generated reference page - with the options all of them share, the exit codes, the machine output and the…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/migrations/commands.md

On this page

Migration commands

The migration commands run from the installation root as ./console exp:migration:<name> (the same program as php bin/php/expmigration<name>.php). Run them as the user the web server runs as; as root, add --allow-root-user. Every command that writes is a dry run until it is given --apply. Each command's full list of options is on its generated reference page, made from the command's own option definitions.

Contents

  1. The commands
  2. By task
  3. Options most commands share
  4. Exit codes and the machine output
  5. The exp:upgrade commands that work with migrations
  6. Related pages

The commands

CommandWhat it doesMost used optionsReference
exp:migration:statusevery migration with its state (done, pending, not-needed, failed, unknown), the orphans, the latest runs, the pushes that wait, the lock--fail-on-pending, --runs, --environmentexpmigrationstatus
exp:migration:migratethe dry run, and with --apply the run: caption, migrations in order, restore on failure, re-caption, commit, tag, push--apply, --only, --path, --environment, --login, --no-commit, --no-push, --force --reasonexpmigrationmigrate
exp:migration:dry-runthe plan of every pending migration; --simulate runs them in a transaction that is rolled back (PostgreSQL, SQLite), --diff shows what changed--simulate, --diff, --only, --pathexpmigrationdryrun
exp:migration:rollbacktakes back a run (its pre caption), one migration (its down()), or, for experts, any caption<run-id>, <migration-id>, --expert --confirm=<caption-id>, --partsexpmigrationrollback
exp:migration:resumea new run of what a failed or interrupted run left pending--apply, --onlyexpmigrationresume
exp:migration:captiona caption of the installation now, or the list of captions--apply, --list, --labelexpmigrationcaption
exp:migration:pushpushes the runs whose push failed--apply, --limitexpmigrationpush
exp:migration:checkthe lint of the migration files, without a database: names, headers, order, PHP syntax, the class--path, --environmentexpmigrationcheck
exp:migration:generatewrites a new PHP migration from the skeleton--skeleton <name>, --description, --author, --source=extension:<name>, --applyexpmigrationgenerate
exp:migration:convertconverts YAML migrations of the reference bundle into YAML migrations of Exponential; what does not convert is listed in the new file<file or folder>, --source=extension:<name>, --applyexpmigrationconvert
exp:migration:repo:splitsplits the migrations folder into a repository of its own, with its history--to, --remote, --branch, --applyexpmigrationreposplit

By task

TaskCommandsRecipe
write a migrationexp:migration:generate --skeleton <name> --apply, then exp:migration:checkthe tutorial
see what would changeexp:migration:migrate, exp:migration:dry-run --simulate --diffTesting migrations
apply the pending migrationsexp:migration:migrate --applyDeploying with migrations
gate a pull request in CIexp:migration:check, exp:migration:status --fail-on-pendingTesting migrations
go backexp:migration:rollback <run-id> --apply, exp:migration:rollback <migration-id> --applyCaptions and rollback in practice
finish an interrupted runexp:migration:resume --applyLarge data migrations
push what did not reach the remoteexp:migration:push --applyPushing tags
take a safe point by handexp:migration:caption --apply --label="before the import"Captions and rollback in practice

Options most commands share

OptionMeaning
--applymake the changes; without it, a dry run that changes nothing
--format=jsonthe machine output exp-migration/1 instead of text
--environment=<name>count the migrations for another environment than the installation's (site.ini [AdminEnvironment] Level, or EXP_ENV with Level=auto)
--login=<login>run as this user instead of migration.ini [RunSettings] RunAsUser
--only=<ids>only these migrations (a comma list or repeated)
--path=<files or folders>only the migrations in these files or folders; exp:migration:check checks them instead of the migration folders
--run-id=<id>, --progress=<file>name the run before it starts, and follow it through a file of JSON lines (what the administration uses)

Every script also takes the standard options of the script framework (--help, --siteaccess, --debug, --quiet, --allow-root-user).

Exit codes and the machine output

CodeMeans
0done, or nothing to do
1a migration failed, a check found a problem, the lock was held, a changed file was refused, or something is pending with exp:migration:status --fail-on-pending
2usage: an option is wrong or missing, or uncommitted code refused a run
3the database is not reachable
4internal error

--format=json writes exp-migration/1: the run, the environment, the engine and its transaction mode, every migration with its state, action and messages, the captions, the repository, a summary, the errors, the warnings and the exit code (The machine output).

./console exp:migration:status --fail-on-pending --format=json > var/log/migration-status.json || echo "pending or failed"

The exp:upgrade commands that work with migrations

The kernel's upgrade steps are migrations of the source kernel, and exp:upgrade shares the record, the lock and the captions with the migrations:

CommandWith migrations
exp:upgradecreates the record tables (step 6.0.15-migration-tables); runs every stage, also code, libraries and finish, which a migration run leaves to it
exp:upgrade:statusthe steps and their state; a step applied by a migration run is done here too
exp:upgrade:captionslists the captions of upgrades and of migration runs (kinds migration-pre, migration-post, migration-failure)
exp:upgrade:rollbackrestores any caption, also one a migration run took
exp:upgrade:finishafter a migration run that applied steps, or after a restore: deploy, caches, smoke check
exp:upgrade:verifyfinds drift: a step recorded done whose effect is missing

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x