`Gist` index not supported on prisma schema
See original GitHub issueBug description
Hello
I’m introspecting my database and this is the schema that is being generated when I use the prisma cli and run npx prisma db pull
.
model appointment {
account_id String @default(dbgenerated("(current_setting('app.account'::text))::uuid")) @db.Uuid
id String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
date Unsupported("tstzrange")
patient_id String @db.Uuid
is_paid Boolean @default(false)
is_active Boolean @default(true)
created_at DateTime @default(now()) @db.Timestamptz(6)
patient patient @relation(fields: [account_id, patient_id], references: [account_id, id], onDelete: NoAction, onUpdate: NoAction, map: "FK_Appointment_patient_id__Patient_id")
account account @relation(fields: [account_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
@@id([account_id, id], map: "PK_Appointment_account_id_id")
@@index([account_id, date], map: "appointment_account_id_date_excl", type: Gist)
}
I get the following error once I try to generate the client by running npx prisma generate
.
This is the error.
Error: Schema validation error - Error (query-engine-node-api library)
Error code: P1012
error: Error parsing attribute "@@index": The Gist index field type `Uuid` has no default operator class.
--> schema.prisma:54
|
53 | @@id([account_id, id], map: "PK_Appointment_account_id_id")
54 | @@index([account_id, date], map: "appointment_account_id_date_excl", type: Gist)
|
Validation Error Count: 1
[Context: getDmmf]
I thought Gist indexes where supported as stated on https://www.prisma.io/docs/concepts/components/prisma-schema/indexes#index-configuration
How to reproduce
Try to generate the prisma client based from this schema, use the cli npx prisma generate
.
model appointment {
account_id String @default(dbgenerated("(current_setting('app.account'::text))::uuid")) @db.Uuid
id String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
date Unsupported("tstzrange")
patient_id String @db.Uuid
is_paid Boolean @default(false)
is_active Boolean @default(true)
created_at DateTime @default(now()) @db.Timestamptz(6)
patient patient @relation(fields: [account_id, patient_id], references: [account_id, id], onDelete: NoAction, onUpdate: NoAction, map: "FK_Appointment_patient_id__Patient_id")
account account @relation(fields: [account_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
@@id([account_id, id], map: "PK_Appointment_account_id_id")
@@index([account_id, date], map: "appointment_account_id_date_excl", type: Gist)
}
Expected behavior
The prisma client is generated with no errors.
Prisma information
model appointment {
account_id String @default(dbgenerated("(current_setting('app.account'::text))::uuid")) @db.Uuid
id String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
date Unsupported("tstzrange")
patient_id String @db.Uuid
is_paid Boolean @default(false)
is_active Boolean @default(true)
created_at DateTime @default(now()) @db.Timestamptz(6)
patient patient @relation(fields: [account_id, patient_id], references: [account_id, id], onDelete: NoAction, onUpdate: NoAction, map: "FK_Appointment_patient_id__Patient_id")
account account @relation(fields: [account_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
@@id([account_id, id], map: "PK_Appointment_account_id_id")
@@index([account_id, date], map: "appointment_account_id_date_excl", type: Gist)
}
Environment & setup
- macOS
- Postgres 14
- Prisma CLI Version : 4.3.1
- Node 16.15.1
Prisma Version
4.3.1
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Indexes - Prisma
Prisma allows configuration of database indexes, unique constraints and primary key constraints. This is in General Availability in versions 4.0.0 and later ...
Read more >Support GiST Index type with Postgres · Issue #10634 · prisma ...
Problem. I'm trying to use Prisma with geographic data in PostGIS. · Suggested solution. Allow GiST as an option to the type parameter...
Read more >How to configure indexes in Prisma - LogRocket Blog
Configuring indexes in Prisma. From Prisma version 3.5.0 and above, indexes can be enabled through the extendedIndexes preview feature. But, ...
Read more >GIN indexes | YugabyteDB Docs
GIN indexes currently support IndexScan only, not IndexOnlyScan. The difference is that IndexScan uses the results of a scan to the index for...
Read more >could not open extension control file "/usr/share/postgresql/13 ...
I added the following model to my prisma.schema: ... @@index([geometry], name: "geometry_idx", type: Gist) created_at DateTime ...
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
Internal: Next step is to try to reproduce locally what @gmwill934 is seeing, and then figure out what is going on with that ops class.
Absolutely @janpio
Account
Patient
Appointment