graphql-engine/docs/graphql/manual/hasura-cli/hasura_migrate_create.rst
2020-05-11 17:44:48 +05:30

76 lines
2.9 KiB
ReStructuredText

.. meta::
:description: Use hasura migrate create to create migration files for Hasura migrations with the Hasura CLI
:keywords: hasura, docs, CLI, hasura migrate create
.. _hasura_migrate_create:
Hasura CLI: hasura migrate create
---------------------------------
Create files required for a migration.
Synopsis
~~~~~~~~
Create ``sql`` and ``yaml`` files required for a migration.
::
hasura migrate create [migration-name] [flags]
Examples
~~~~~~~~
::
# Setup migration files for the first time by introspecting a server:
hasura migrate create "init" --from-server
# Use with admin secret:
hasura migrate create --admin-secret "<admin-secret>"
# Setup migration files from an instance mentioned by the flag:
hasura migrate create init --from-server --endpoint "<endpoint>"
# Take pg_dump of schema and hasura metadata from server while specifying the schemas to include
hasura migrate create init --from-server --schema myschema1,myschema2
# Take pg_dump from server and save it as a migration and specify the schemas to include
hasura migrate create init --sql-from-server --schema myschema1,myschema2
Options
~~~~~~~
::
--from-server get SQL statements and Hasura metadata from the server
-h, --help help for create
--metadata-from-file string path to a hasura metadata file to be used for up actions
--metadata-from-server take metadata from the server and write it as an up migration file
--schema strings name of Postgres schema to export as a migration. provide multiple schemas with a comma separated list e.g. --schema public,user (default [public])
--sql-from-file string path to an SQL file which contains the SQL statements
--sql-from-server take pg_dump from the server and save it as a migration
Options inherited from parent commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
--admin-secret string admin secret for Hasura GraphQL engine
--certificate-authority string path to a cert file for the certificate authority
--endpoint string http(s) endpoint for Hasura GraphQL engine
--envfile string .env filename to load ENV vars from (default ".env")
--insecure-skip-tls-verify skip TLS verification and disable cert checking (default: false)
--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
SEE ALSO
~~~~~~~~
* :ref:`hasura migrate <hasura_migrate>` - Manage migrations on the database
*Auto generated by spf13/cobra*