steebchen / prisma-client-go

Prisma Client Go is an auto-generated and fully type-safe database client
https://goprisma.org
Apache License 2.0
2.02k stars 96 forks source link

error: The preview feature "prismaSchemaFolder" is not known #1313

Closed qg5 closed 5 days ago

qg5 commented 5 days ago

This error happens in the following cases:

  1. go run github.com/prisma/prisma-client-go generate
  2. client.Connect()
app/
└── prisma/
    ├── db/
    ├── migrations/
    ├── schema/
    │   ├── schema.prisma
    │   └── other.prisma

From the app directory I am able to run prisma migrate dev and it will run successfully, same with prisma studio and the other commands.

prisma : 5.16.1 @prisma/client : 5.16.1

Full error:

{
   "is_panic":false,
   "message":"\u001b[1;91merror\u001b[0m: \u001b[1mThe preview feature \"prismaSchemaFolder\" is not known. Expected one of: filterJson, referentialIntegrity, interactiveTransactions, fullTextSearch, fullTextIndex, dataProxy, extendedIndexes, cockroachdb, tracing\u001b[0m\n  \u001b[1;94m-->\u001b[0m  \u001b[4mschema.prisma:205\u001b[0m\n\u001b[1;94m   | \u001b[0m\n\u001b[1;94m204 | \u001b[0m  provider        = \"go run github.com/prisma/prisma-client-go\"\n\u001b[1;94m205 | \u001b[0m  previewFeatures = \u001b[1;91m[\"prismaSchemaFolder\"]\u001b[0m\n\u001b[1;94m   | \u001b[0m\n\nValidation Error Count: 1",
   "meta":{
      "full_error":"\u001b[1;91merror\u001b[0m: \u001b[1mThe preview feature \"prismaSchemaFolder\" is not known. Expected one of: filterJson, referentialIntegrity, interactiveTransactions, fullTextSearch, fullTextIndex, dataProxy, extendedIndexes, cockroachdb, tracing\u001b[0m\n  \u001b[1;94m-->\u001b[0m  \u001b[4mschema.prisma:205\u001b[0m\n\u001b[1;94m   | \u001b[0m\n\u001b[1;94m204 | \u001b[0m  provider        = \"go run github.com/prisma/prisma-client-go\"\n\u001b[1;94m205 | \u001b[0m  previewFeatures = \u001b[1;91m[\"prismaSchemaFolder\"]\u001b[0m\n\u001b[1;94m   | \u001b[0m\n\nValidation Error Count: 1"
   },
   "error_code":"P1012"
}

My schema.prisma looks like this

generator client {
  provider        = "go run github.com/prisma/prisma-client-go"
  output          = "../db"
  previewFeatures = ["prismaSchemaFolder"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}
steebchen commented 5 days ago

Which Go client version are you on?

qg5 commented 5 days ago

Go version: v1.21

steebchen/prisma-client-go: v0.38.0

qg5 commented 5 days ago

Nevermind, fixed by going into my gopath and deleting the old package and installing the new one, for some reason the version v0.17.0 of your package was being kept. I deleted the folder and ran go get again and it all works well now

steebchen commented 4 days ago

Great, thanks for the update 👍