For any project in the Prisma Data Platform, you can create multiple environments and associate each with a different database and a different Data Proxy region.

You can use environments to isolate database development activities with separate branches and databases, and dedicate each environment to an activity, such as Development, Staging, Production, and so on.

About creating environments

When you create a new environment on a project, the steps differ slightly depending on whether you have schema synchronization enabled on the default environment.

The table below shows the different project configurations and provides links to the correct steps to create a new environment for each project configuration.

ConfigurationSteps
Projects with enabled schema synchronizationSteps
Projects with introspected schema or no schema (empty database) or uploaded schemaSteps

Projects with enabled schema synchronization

If you already have schema synchronization enabled for the default Production environment, you can do the same for each new environment you create.

Prerequisites

  • You are the Project owner or have the Admin role for the project.
  • You have a database connection string for the new environment.
  • Based on your project plan quota, check if you have the capacity for more environments.
  • Create a new branch in the GitHub repository of the project and push new versions of the Prisma schema for the environment in that branch.

Steps

  1. From the Environments drop-down menu, select Create new environment.

    Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment
  2. In Environment name, enter a name for the environment.

    Note

    Use any naming convention that makes sense for your project.

    If applicable, you can use the Staging, Development, or <Feature name> conventions to dedicate an environment to a database development workflow or the development of a specific feature.

  3. Enable schema synchronization for the new environment.

    Important

    The steps to enable schema synchronization on new environments are available only if you have already enabled schema synchronization on the default Production environment for the same project.
    Additionally, you must select a branch from the same repository configured for the Production environment.

    Because of this, you cannot select a different repository when you create a new environment.

    a. From Branch, select the branch of the project repository that you want to use for the new environment.

    b. In Prisma Schema path, enter the path to your schema.prisma file. The pre-filled path prisma/schema.prisma is the default path. Change it to the path you plan to use in the environment.

  4. In Connection string, paste the database connection string for the new environment.

  5. (Optional) From Static IPs, select Enabled if your database is behind a firewall and you can only configure external access from specific IP addresses. Copy the IP addresses and add them to the allowlist of your database.

    Note

    For more information, see Static egress IP address.
    1. Under Data Proxy, from the Location drop-down menu, select the geographic location for the Data Proxy.
    Note

    Select a Data Proxy location that is close to the geographic location of the database for the new environment.

    If you select a location that is geographically distant from the database, then when your application sends requests to the database through the Data Proxy, you might notice some delay in the responses.
    Important

    After you create an environment, you cannot change its Data Proxy location. You can select a different Data Proxy location only when you create a new environment.
  6. Click Create environment.

    Prisma Data Platform - Create environment - Name environment, select branch, enter Prisma schema path, enter a database connection string, select Data Proxy region, enable firewalled connection via static IPs to your database

Result

The platform creates a new environment for the project. The new environment appears in the Environments drop-down menu.

The platform links the Prisma schema from the selected branch so that it can keep your project up-to-date with the latest schema version. Your updates to your Prisma schema keep the models and attributes up-to-date in Data Browser, Query Console, and also the schema contents in Schema Viewer.

Your browser is redirected to Data Browser for the new environment.

What's next

You can switch between the environments of a project from the Environments drop-down menu in the upper left (next to the Projects drop-down).

Prisma Data Platform - Manage environments - Switch between environments from the Environments drop-down
  • After you switch to a different environment, Data Browser and Query Console use the database and Data Proxy location configured for that environment.
  • What Schema Viewer shows differs depending on whether your database is empty or contains some models. For more information, see Manage schema updates with Schema Viewer.

Projects with an introspected schema or with no schema

If you do not yet have schema synchronization enabled for the Production environment of a project (that means that the database is empty or that the platform introspected and generated a Prisma schema), you can create new environments without the need to enable schema synchronization.

Prerequisites

  • You are the Project owner or have the Admin role for the project to create a new environment.
  • You have a database connection string for the new environment.
  • Based on your project plan quota, check if you have the capacity for more environments.

Steps

  1. From the Environments drop-down menu, select Create new environment.

{' '}

Prisma Data Platform - Create environment - Open Environments drop-down menu and select Create new environment
  1. In Environment name, enter a name for the environment.

    Note

    Use any naming convention that makes sense for your project.

    If applicable, you can use the Staging, Development, or <Feature name> conventions to dedicate an environment to a database development workflow or the development of a specific feature.

  2. In Connection string, paste the database connection string for the new environment.

  3. (Optional) From Static IPs, select Enabled if your database is behind a firewall and you can only configure external access from specific IP addresses. Copy the IP addresses and add them to the allowlist of your database.

    Note

    For more information, see Static egress IP address.
  4. Under Data Proxy, from the Location drop-down menu, select the geographic location for the Data Proxy.

    Note

    Select a Data Proxy location that is close to the geographic location of the database for the new environment.

    If you select a location that is geographically distant from the database, then when your application sends requests to the database through the Data Proxy, you might notice some delay in the responses.
    Important

    After you create an environment, you cannot change its Data Proxy location. You can select a different Data Proxy location only when you create a new environment.
  5. Click Create environment.

    Prisma Data Platform - Create environment - Name environment, select branch, enter Prisma schema path, enter a database connection string, select Data Proxy region, enable firewalled connection via static IPs to your database

Result

The platform creates a new environment for the project. The new environment appears in the Environments drop-down menu.

If the database for the new environment does not contain any models

You see a notification that the database for the new environment is empty. Because the database does not contain any models, the introspection cannot generate a Prisma schema.

As a result, Data Browser or Query Console for the environment remain inactive. You can start using them after you enable Prisma schema synchronization for the environment.

Your browser is redirected to Schema Viewer for the new environment.

If the database for the new environment contains models

The platform introspects the database to read the data models so that it can generate the Prisma schema. The Prisma schema enables the features in Data Browser and Query Console, where you can edit and query your data, or view your schema.

Your browser is redirected to Data Browser for the new environment.

If introspection fails and can't generate a schema

You will be prompted with an error notification that introspection failed. This means the environment was not created. The error prompt will contain an Upload a schema button that will allow you to complete environment creation by uploading a schema.

Upload a schema file

Steps:

  1. On the notification, click Upload a schema file

    Prisma Data Platform - Create environment - Upload a schema file button
  2. On the Upload a schema file section, either

    • Click on the drop zone to open your file manager and select your schema
    • Drag and drop your schema file to the drop zone
  3. Review the preview of your schema file

    Note

    The schema preview does not contain any syntax highlighting for your schema file.
  4. Click Upload file.

    Prisma Data Platform - Create environment - Upload your schema - Select Prisma schema file from file system

What's next

You can switch between the environments of a project from the Environments drop-down menu in the upper left (next to the Projects drop-down).

Prisma Data Platform - Manage environments - Switch between environments from the Environments drop-down
  • After you switch to a different environment, Data Browser and Query Console use the database and Data Proxy location configured for that environment.
  • What Schema Viewer shows differs depending on whether your database is empty or contains some models. For more information, see Manage schema updates with Schema Viewer.
Edit this page on GitHub