Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

fauna schema pull

Pull a database’s remote .fsl schema files into a local schema directory.

Syntax

fauna schema pull [--active] [--[no-]color ] [--delete]
  [--dir <value>] [--endpoint <value>] [--environment <value>]
  [--help] [--secret <value>] [--timeout <value>]
  [--url <value>]

Description

fauna schema pull pulls a database’s remote .fsl schema files into a local schema directory.

If the database has staged schema, the command pulls the database’s remote staged schema by default. If the database has no staged schema, the command pulls the database’s remote schema.

To pull the remote active schema regardless of whether schema is staged, use the --active option. See Pull active schema files.

You can check whether a database has staged schema using fauna schema status.

Arguments

None

Options

Option Description

--active

Pulls remote active schema files for the database into the local schema directory.

--[no-]color

Enables or disables color formatting for the output. Color formatting is enabled by default if the terminal supports it (determined using chalk/supports-color). Use --no-color to disable.

--delete

Delete .fsl files in the local directory that aren’t part of the database schema.

--dir

A local directory to pull .fsl files into. Defaults to the directory specified in .fauna-project.

--endpoint

Fauna server endpoint.

--environment

Environment to use from .fauna-project.

--help

Help for schema pull command.

--secret

Authentication secret. Overrides the secret in .fauna-shell.

Use a scoped key to interact with a child database using a parent database’s admin key.

For example, with a parent database’s admin key secret of fn123, you can access a child database by appending the child database name and role: fn123:childDB:admin.

--timeout

Connection timeout in milliseconds.

--url

Database URL. Overrides the url in .fauna-shell.

Examples

Basic example

fauna schema pull

If the database has staged schema, the command pulls the database’s remote staged schema.

If the database has no staged schema, the command pulls the database’s remote schema.

Pull active schema files

Use the --active option to pull the database’s remote active schema regardless of whether the database has staged schema:

fauna schema pull --active

Delete local files

The schema pull command overwrites existing schema files in the local directory.

If wanted, you can use the --delete option to delete local .fsl files that aren’t part of the remote schema:

fauna schema pull --delete

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!