Overview

Environment configuration

Prisma does not natively support configuring different environments, i.e. development, staging, production.

The database connection URI can be pointed to an environment variable, which in turn, is possible to change dynamically by using tools like dotenv-cli, dotenv-flow, etc.

Example:

Because of the lack of a better primitive, developers often prepend CLI calls with DATABASE_URL environment variables, e.g. DATABASE=url prisma migrate reset .

A developer could inadvertently pass the production database URI instead of the development database URI and accidentally erase the production database.

We want to provide better primitives for managing environments so that developers can

The solution should not a hard requirement: developers who already have something in place for managing environments, because they set up their own, or because they are using a framework, such as Redwood.js or Blitz.js, should not have to deal with additional complexity.

Prisma-level configuration

Prisma supports configuring certain aspects via the Prisma schema file:

While this solution is pragmatic and works, we want to enable users with solutions allowing them to decouple configuration from the Prisma schema if they need to, to have better control over how they structure their configuration.

Example: