DavidHancu / prisma-util

Merge multiple Prisma schema files, model inheritance, resolving name conflicts and timings reports, all in a simple tool.
Apache License 2.0
40 stars 1 forks source link

[v1.4.0] Additional ways of configuring your schema (YAML and XML) #2

Closed DavidHancu closed 1 year ago

DavidHancu commented 2 years ago

Additional ways of configuring schemas without the use of .env files

As with the code-generated schemas proposal, I've seen many people interested in this feature. Basically, allow the DATABASE_URL environment variable to be used from another file, such as YAML and XML.

Design

My aim is to make this system as easy as possible and as such I thought about this feature as a perfect fit for the Experimental tag. To use it, you'd have to add 2 more keys in your configuration file:

{
    "additionalFormats": true,
    "configurations": ["configuration.yml", "another.yml"]
}

As with any experimental feature, you have to add additionalFormats to enable the feature. The configurations array provides a list of relative paths for the YAML and XML files (by the way, you can suggest more formats!).

In this example, the another.yml file would take priority and override configuration.yml, as it's the one set at the end.

Example

As with all proposals, here's what I think that this configuration could look like:

datasource:
    provider: "postgresql"
    url: "DATABASE_URL"

Wrapping Up

Let me know what you think about this proposal and any improvements you'd like to see!

DavidHancu commented 2 years ago

Confirmed coming in v1.4.0.

DavidHancu commented 1 year ago

Feature cancelled. (Candidate for v2.1.0)