`nativeTypes` Preview Feature not Recognized in Generator Block
See original GitHub issueBug description
When trying to use a native database type, an error indicates that the nativeTypes
feature must first be enabled in the Datasource
block:
However, at runtime or when migrating, seeding and etc., an error suggests that previewFeatures should only be placed in the generator
block:
Entering the nativeTypes
feature in the expected generator block
does not validate any native type fields, like @db.Uuid
.
How to reproduce
- First, try generating the client with the schema as is with.
prisma generate
. You’ll get the error mentioned above. - Move the
previewFeatures = ["nativeTypes"]
line to thedatasource block
, you’ll notice no error is shown for the native type@db.Uuid
but will throw an error once you try to doprisma generate
.
Expected behavior
It should run and recognize any or all native data types without throwing errors
Prisma information
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["nativeTypes"]
}
model User {
id String @id @db.Uuid @default(dbgenerated("uuid_generate_v4()"))
email String @unique
name String?
}
Environment & setup
- OS: MacOS
- Database: PostGreSQL
- Node.js version: v14.15.3
Prisma Version
- Prisma: v2.23.0
- Prisma Client: v2.23.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Prisma generate or introspect don't work when nativeTypes ...
When you have in your prisma schema enabled nativeTypes preview feature, running prisma generate or prisma introspect throws error:.
Read more >Prisma schema API (Reference)
previewFeatures, No, List of Enums, Use intellisense to see list of currently available Preview features ( Ctrl+Space in Visual Studio Code) Default: none....
Read more >Prisma & PlanetScale Best Practices - YouTube
So the preview feature flag `referentialIntegrity` will no longer be necessary in the ` generator client` block of the Prisma Schema.
Read more >C/C++ Project Properties (Visual Studio) - Microsoft Learn
Reference guide to the Visual Studio Microsoft C/C++ project Property Pages properties.
Read more >CodeSmith Generator Release Notes - Spaces - Confluence
Fixed breaking issue where non blocked if statements wouldn't be rendered ... Fixed a bug where the View Visible Whitespace feature wasn't working...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, So I reinstalled VS Code and it seems to be working fine now. I assume it was an outdated Prisma plugin installed via Settings Sync from an other computer.
Thanks for the info @Karl-EdwardFPJeanMehu
I am going to close this. I can’t reproduce this from the CLI.