Commands¶
esmigrate [OPTIONS] COMMAND [ARGS]...
Global options¶
Option |
Description |
|---|---|
|
Profile to load (default |
|
Show debug output, including one line per Elasticsearch request. |
|
Show warnings and errors only. Cannot be combined with |
|
Write a debug log file, overriding the profile’s |
|
Show the version. |
|
Show help; |
Status messages go to standard error; standard output only carries real output (config, --version, the banner).
init¶
Creates the schema version table if needed and reports the latest applied version. If it finds a table from
ElasticMigrate v1, it upgrades it to the current layout and keeps the old table as esm_schema_version_v1_backup. Every
other command refuses to run against a v1 table (exit code 22). See Schema databases.
config¶
Prints the effective profile with secrets masked.
upgrade¶
esmigrate upgrade [-s VERSION]
Runs every pending script, in version order, up to the latest one or up to -s/--schema-version (for example
-s 1.10). Scripts at or below the latest recorded version are skipped. upgrade refuses to run while the latest
recorded script has failed (exit code 21).
rollback¶
Removes failed entries from the history so that upgrade can run again after you fix the script. It does not undo
changes in Elasticsearch: fix the cause, adjust the script if needed, then run upgrade.
reset¶
Removes the whole history of the profile’s namespace. Elasticsearch is not touched; the next upgrade runs every
script again.
unlock¶
esmigrate unlock [-y]
Removes a stuck SQLite migration lock left by a crashed run, after confirmation (-y/--yes skips it). PostgreSQL and
MySQL locks are released automatically and need no unlocking. See Migration lock.
upgrade, rollback and reset hold the migration lock while they run.
Exit codes¶
Code |
Meaning |
|---|---|
|
Success, including “nothing to do”. |
|
Invalid command-line usage. |
|
Profile not found. |
|
Invalid configuration (profile values, certificates, log file). |
|
Schema database unreachable, unsupported or missing its schema. |
|
Schema database error, or the latest script failed. |
|
Schema version table uses the v1 layout; run |
|
Migration lock held by another run. |
|
|
|
Script file name or content cannot be read or does not match the pattern. |
|
Script cannot be parsed. |
|
Invalid |
|
Elasticsearch returned an error response. |
|
Elasticsearch unreachable, timed out or failed TLS. |