notiz-dev / prisma-dbml-generator

Prisma DBML Generator
MIT License
685 stars 37 forks source link

fix: add support for prisma ^2.20 #9

Closed williamluke4 closed 3 years ago

williamluke4 commented 3 years ago

Breaking Change for custom generators

Hey Folks, In 2.20 the provider and the output for generators can now be env vars. This means these values will now be provided to you as an Object and not as a string. You can see the relevant changes below.

export interface EnvValue {
  fromEnvVar: null | string
  value: string
}
export interface GeneratorConfig {
  output: EnvValue | null # Changed from string | null
  provider: EnvValue # Changed from string
}
// There is a utility in the SDK to help you get the string value. 
import { parseEnvValue } from '@prisma/sdk'
// parseEnvValue(provider: EnvValue):string
williamluke4 commented 3 years ago

Note: I have not tested this with previous versions of prisma

marcjulian commented 3 years ago

@williamluke4 thank you!! Works fine with previos prisma versions.