upload-graphql-schema

Summary

Uploads and imports the specified GraphQL schema file to the GraphQL API.

fauna upload-graphql-schema GRAPHQL_FILE_PATH

Description

The upload-graphql-schema command uploads and imports the specified GraphQL schema file to the GraphQL API.

Use the optional --mode parameter to specify the schema import mode.

If you don’t pass any options at the command line, Fauna uses the options specified in the fauna-shell configuration file.

Arguments

Argument Description

GRAPHQL_FILE_PATH

The path to the GraphQL schema file that you want to upload to the GraphQL API. The filename must have either the .gql or .graphql extension.

Options

Option Description

--domain=<domain>

Optional - The Fauna server domain, that is, the hostname where Fauna is running. Defaults to db.fauna.com.
Since the introduction of Region Groups, three cloud domains are available. You do not need to specify a domain, but connections work as expected if you do.
Classic (US and EU): db.fauna.com
United States (US): db.us.fauna.com
Europe (EU): db.eu.fauna.com

--endpoint=<endpoint>

Optional - The name of the endpoint to use for the command.

--port=<port>

Optional - The connection port. Defaults to 8443.

--scheme=<scheme>

Optional - The connection scheme. Must be one of https or http. Defaults to https.

--secret=<secret>

Optional - The secret to use. A secret authenticates your connection to Fauna, and connects you to a specific database.

--timeout=<timeout>

Optional - The connection timeout, an integer number of milliseconds. When the specified period has elapsed, fauna-shell stops waiting for a response and displays an error.

The default is zero, which means that fauna-shell waits until a response is received.

--graphqlHost=<GraphQLAPI host name>

Optional - The hostname of the GraphQL API to connect to.

--graphqlPort=<GraphQLAPI host port>

Optional - The port of the GraphQL API to connect to.

--mode=<import_mode>

Optional - The schema import mode to use. Must be one of:

  • merge: combines the new schema with the existing schema.

  • replace: replaces the existing schema with the new schema.

  • override: replaces the existing schema with the new schema AND deletes all of the associated documents and indexes.
    Data loss occurs with override mode!

The default mode is merge.

Examples

  1. The following example imports a schema file in the current directory:

    fauna upload-graphql-schema ./schema.gql
    UPLOADING SCHEMA (mode=merge): ./schema.gql
    RESPONSE:
    Schema imported successfully.
    Use the following HTTP header to connect to the FaunaDB GraphQL API:
    { "Authorization": "Bearer fnAEMRODcCACANIiSnji7-BEalUcbAufrmGrgN8m" }
  2. The following example imports the same schema file as the previous example, this time using the replace schema import mode:

    fauna upload-graphql-schema ./schema.gql --mode=replace
    UPLOADING SCHEMA (mode=replace): ./schema.gql
    RESPONSE:
    Schema imported successfully.
    Use the following HTTP header to connect to the FaunaDB GraphQL API:
    { "Authorization": "Bearer fnAEMRODcCACANIiSnji7-BEalUcbAufrmGrgN8m" }

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!