Skip to content

Commit

Permalink
Add a note on switching data sources
Browse files Browse the repository at this point in the history
  • Loading branch information
sameoldmadness committed Jul 29, 2019
1 parent c44c114 commit 4912752
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/prisma-schema-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ You can use environment variables to provide configuration options when a CLI co

Environment variables can be provided using the `env` function:

```
```groovy
datasource pg {
provider = "postgresql"
url = env("POSTGRES_URL")
Expand All @@ -217,6 +217,17 @@ datasource pg {

### Switching data sources based on environments

> This feature [is not implemented yet](https://github.com/prisma/prisma2/issues/265#issuecomment-515955670). As a workaround you can provide environment variables for both `url` and `provider` options.
```groovy
datasource db {
provider = env("PRISMA_PROVIDER")
url = env("PRISMA_URL")
}
```

---

Sometimes it's helpful to target different environments based in the same schema file, for example:

```groovy
Expand Down

0 comments on commit 4912752

Please sign in to comment.