Package and version
- prisma-next: 0.12.0
- @prisma-next/postgres: 0.12.0
- Node: v22.x
- Package manager: bun 1.3.x
- OS: macOS (darwin)
- Source DB: PostgreSQL 15 (local Supabase)
What happened?
Postgres allows multiple distinct indexes on the same column(s) — commonly partial indexes with different WHERE clauses. contract infer emits them as multiple @@index attributes on the same column set:
model RejectedUploads {
accountId String @map("account_id")
// ...
@@index([accountId], map: "idx_rejected_uploads_account_id")
@@index([accountId], map: "idx_rejected_uploads_unresolved")
@@index([accountId], map: "rejected_uploads_account_open_idx")
}
contract emit rejects multiple @@index definitions with the same column set within one model. Deduplicating by column set (our workaround) loses real partial indexes from the DB.
What did you expect to happen?
PSL should support partial index predicates (WHERE …) or otherwise preserve distinct Postgres indexes that share the same key columns.
Minimal reproduction
- DB table with 2+ indexes on the same column(s) where at least one is partial (different
pg_indexes.indexdef / WHERE clause)
contract infer → contract emit
- Emit fails or forces dropping duplicate
@@index lines
Workaround
Dedupe @@index([…]) by column set before emit (loses partial-index fidelity).
Package and version
What happened?
Postgres allows multiple distinct indexes on the same column(s) — commonly partial indexes with different
WHEREclauses.contract inferemits them as multiple@@indexattributes on the same column set:contract emitrejects multiple@@indexdefinitions with the same column set within one model. Deduplicating by column set (our workaround) loses real partial indexes from the DB.What did you expect to happen?
PSL should support partial index predicates (
WHERE …) or otherwise preserve distinct Postgres indexes that share the same key columns.Minimal reproduction
pg_indexes.indexdef/WHEREclause)contract infer→contract emit@@indexlinesWorkaround
Dedupe
@@index([…])by column set before emit (loses partial-index fidelity).