Manage schema
reference: FSL reference |
---|
Schema management involves schema definition, update, and versioning using commonly accepted code management tools and practices instead of improvised manual processes. By using configuration and schema files to define your projects and database schema, you can easily make updates to your environment and schema and reliably share those updates.
Schema entities are defined in one or more FSL files with a .fsl extension. The Fauna CLI tools promote FSL file and project configuration file management and version control using the same tools and processes that you use with your application source code. Using the Fauna CLI, which is designed to help an engineering team manage schema as code in a repository and help users promote their schema through development, testing, and production environments, you have control over your schema as it progresses through the full software development life cycle.
Schema management builds on the following concepts:
- Project
-
A project is a directory that includes the configuration and all FSL files that define the schema and maps to an application project.
Project configuration is stored in the .fauna-project file. The file is a way to configure the database connections used by an application project and to share that configuration with the application development team. You create or initialize the file with the
project init
command. You’re advised to commit the .fauna-project file and your .fsl files to the application code repository so that other team members can use the same configuration when they clone the repository. - Environment
-
An environment is a set of named database connections that is an instance of your project. It typically maps to the team development, test, staging, production, or other individual database. A project can have multiple environments.
An environment is defined by a name, which is prefaced by the word
environment
, and the endpoint and database it is associated with. Environment definitions for your project are stored in the .fauna-project file. The Shell uses the default environment or endpoint to find which database to run commands against.Environments are created and managed using the
environment add
,environment list
, andenvironment select
commands. - Endpoint
-
The Fauna CLI references an endpoint to get the secret to use for schema commands.
What you’ll find here
- Get started with schema management
-
This topic gives you a quick introduction to basic FSL commands and the schema management workflow. You’ll set up a project, create a schema file, and push the file to update your remote database schema.
- Develop schema in software projects
-
This topic covers more project management configuration details and best practices. You’ll learn how to add an environment and set the default environment.
- Use protected mode to safely change schema
-
Learn how to use protected mode to help prevent destructive changes to your database.
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!