2020-01-14 15:57:45 +03:00
|
|
|
.. meta::
|
|
|
|
:description: Use hasura migrate apply to apply Hasura migrations on a database with the Hasura CLI
|
|
|
|
:keywords: hasura, docs, CLI, hasura migrate apply
|
|
|
|
|
2018-09-11 14:11:24 +03:00
|
|
|
.. _hasura_migrate_apply:
|
|
|
|
|
|
|
|
Hasura CLI: hasura migrate apply
|
|
|
|
--------------------------------
|
|
|
|
|
2019-09-11 10:17:14 +03:00
|
|
|
Apply migrations on the database.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
Synopsis
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
|
2019-09-11 10:17:14 +03:00
|
|
|
Apply migrations on the database.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
hasura migrate apply [flags]
|
|
|
|
|
2020-02-24 19:19:14 +03:00
|
|
|
Examples
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
# Apply all migrations
|
|
|
|
hasura migrate apply
|
|
|
|
|
|
|
|
# Use with admin secret:
|
|
|
|
hasura migrate apply --admin-secret "<admin-secret>"
|
|
|
|
|
|
|
|
# Apply migrations on another Hasura instance:
|
|
|
|
hasura migrate apply --endpoint "<endpoint>"
|
|
|
|
|
|
|
|
# Mark migration as applied on the server and skip execution:
|
|
|
|
hasura migrate apply --skip-execution
|
|
|
|
|
|
|
|
# Apply a particular migration version only:
|
|
|
|
hasura migrate apply --version "<version>"
|
|
|
|
|
|
|
|
# Apply last 2 down migrations:
|
|
|
|
hasura migrate apply --down 2
|
|
|
|
|
|
|
|
# Apply only 2 up migrations:
|
|
|
|
hasura migrate apply --up 2
|
|
|
|
|
|
|
|
# Apply only a particular version
|
|
|
|
hasura migrate apply --type up --version "<version>"
|
|
|
|
|
|
|
|
# Apply all up migrations upto version 125, last applied is 100
|
|
|
|
hasura migrate apply --goto 125
|
|
|
|
|
|
|
|
# Apply all down migrations upto version 125, last applied is 150
|
|
|
|
hasura migrate apply --goto 125
|
|
|
|
|
|
|
|
# Rollback a particular version:
|
|
|
|
hasura migrate apply --type down --version "<version>"
|
|
|
|
|
|
|
|
# Rollback all migrations:
|
|
|
|
hasura migrate apply --down all
|
|
|
|
|
2018-09-11 14:11:24 +03:00
|
|
|
Options
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2020-02-24 19:19:14 +03:00
|
|
|
--up string apply all or N up migration steps
|
|
|
|
--down string apply all or N down migration steps
|
|
|
|
--goto string apply migration chain up to to the version specified
|
|
|
|
--version string only apply this particular migration
|
|
|
|
--skip-execution skip executing the migration action, but mark them as applied
|
|
|
|
--type string type of migration (up, down) to be used with version flag (default "up")
|
|
|
|
-h, --help help for apply
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
Options inherited from parent commands
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2020-02-24 19:19:14 +03:00
|
|
|
--admin-secret string admin secret for Hasura GraphQL engine
|
|
|
|
--endpoint string http(s) endpoint for Hasura GraphQL engine
|
|
|
|
--log-level string log level (DEBUG, INFO, WARN, ERROR, FATAL) (default "INFO")
|
|
|
|
--no-color do not colorize output (default: false)
|
|
|
|
--project string directory where commands are executed (default: current dir)
|
|
|
|
--skip-update-check skip automatic update check on command execution
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
* :ref:`hasura migrate <hasura_migrate>` - Manage migrations on the database
|
|
|
|
|
|
|
|
*Auto generated by spf13/cobra*
|