fauna schema status
Prints the index build status for a staged schema change.
Syntax
fauna schema status [--[no-]color ] [--dir <value>]
[--endpoint <value>] [--environment <value>] [--help]
[--secret <value>] [--timeout <value>] [--url <value>]
Description
fauna schema status prints the index
build status for a staged schema change. See Run a staged schema change.
Options
| Option | Description |
|---|---|
|
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
|
|
A local directory of |
|
Fauna server endpoint. |
|
Environment to use from |
|
Help for the command. |
|
Authentication secret. Overrides the
secret in 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 |
|
Connection timeout in milliseconds. |
|
Database URL. Overrides the |
Examples
Basic example
To check the status of staged schema:
fauna schema status
The response includes a status for the staged schema and a summary of any staged or local changes:
Connected to endpoint: cloud-us
Staged status: ready
Staged changes:
* Modifying collection `Customer` at collections.fsl:4:1
(use `fauna schema commit` to commit staged changes)
Local changes:
* Modifying collection `Customer` at collections.fsl:4:1
(use `fauna schema diff` to display local changes)
(use `fauna schema push` to stage local changes)
Run a staged schema change
You typically use the schema status command as part of a
staged schema change.
A staged schema change lets you change one or more collection schema without index downtime due to index builds.
To run a staged schema change, you must use the Fauna CLI or the Fauna Core HTTP API’s Schema endpoints.
You can’t run a staged schema change using FQL schema methods or the Fauna Dashboard.
To run a staged schema change using the Fauna CLI:
-
Make the desired changes to
.fslfiles in your schema directory.You can’t use a staged schema change to delete or rename schema. Instead, delete or rename the schema in a separate unstaged schema change.
-
Use
fauna schema pushto stage the schema changes.fauna schema pushstages schema changes by default:# Replace 'us' with your preferred region group: # 'us' (United States), 'eu' (Europe), or `global`. # Replace 'my_db' with your database's name. fauna schema push \ --database us/my_db \ --dir /path/to/schema/dirA database can have one staged schema change at a time. You can update staged schema using
fauna schema push.When a database has staged schema, any access or updates done using FQL’s schema commands on related system collections interact with the staged schema, not the database’s active schema.
For example, when schema changes are staged,
Collection.all()returnsCollectiondocuments for the staged collection schema, not the database’sCollectiondocuments.If a database has staged schema, you can’t edit the database’s active schema using FQL, the Dashboard, or an unstaged schema change. You must first abandon the staged schema change.
-
Use
fauna schema statusto check the status of the staged schema:fauna schema status \ --database us/my_dbPossible statuses:
Staged status Description pendingChanges are being processed. New indexes are still being built.
readyAll indexes have been built. Changes are ready to commit.
failedThere was an error during the staging process.
-
When the status is
ready, usefauna schema committo apply the staged schema to the database:fauna schema commit \ --database us/my_dbYou can only commit staged schema with a status of
ready.If you no longer wish to apply the staged schema or if the status is
failed, usefauna schema abandonto unstage the schema:fauna schema abandon \ --database us/my_db