Skip to content

Commit

Permalink
feat(generator): warn on prisma version mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen committed Nov 11, 2023
1 parent c619d12 commit b6ffabe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 7 additions & 5 deletions generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import (

// Root describes the generator output root.
type Root struct {
Generator Generator `json:"generator"`
OtherGenerators []Generator `json:"otherGenerators"`
SchemaPath string `json:"schemaPath"`
DMMF dmmf.Document `json:"DMMF"`
Datasources []Datasource `json:"datasources"`
Generator Generator `json:"generator"`
OtherGenerators []Generator `json:"otherGenerators"`
SchemaPath string `json:"schemaPath"`
// Version contains the version hash of the Prisma engine
Version string `json:"version"`
DMMF dmmf.Document `json:"DMMF"`
Datasources []Datasource `json:"datasources"`
// Datamodel provides the raw string of the Prisma datamodel.
Datamodel string `json:"datamodel"`
// BinaryPaths (optional)
Expand Down
4 changes: 4 additions & 0 deletions generator/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func addDefaults(input *Root) {
func Run(input *Root) error {
addDefaults(input)

if input.Version != binaries.EngineVersion {
fmt.Printf("\nwarning: prisma CLI version mismatch detected. CLI version: %s, internal version: %s (%s); please see https://github.com/steebchen/prisma-client-go/issues/1099 for details\n\n", input.Version, binaries.EngineVersion, binaries.PrismaVersion)
}

if input.Generator.Config.DisableGitignore != "true" && input.Generator.Config.DisableGoBinaries != "true" {
logger.Debug.Printf("writing gitignore file")
// generate a gitignore into the folder
Expand Down

0 comments on commit b6ffabe

Please sign in to comment.