Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[Feature Request] Partial indexes

Offen
#2,467 1 Kommentar 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
15/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
sql, typescript
Bereich
databases

Rechercherichtung

The desired syntax is spelled out in the request, but no file or entry point is named, so start by finding where ZModel parses and validates @@index/@@unique attributes and follow the path to where the Prisma schema and migrations are generated. A working result means the where filter on @@index/@@unique survives parsing and validation and shows up in the emitted Prisma schema. This is a cross-cutting language-design change touching the parser, validator and generators, and the one comment thread has not settled the design, so it is not a starting point for a first contribution.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Is your feature request related to a problem? Please describe.
Currently, it is not possible to describe partial indexes/unique constraint in the model itself, requiring external sql migration file.

This feature would allow for unique email for accounts that are active for example, or index only records created after a certain date, index active tasks only or allow for better soft deletion flexibility.

Describe the solution you'd like

model User {
  id        String   @id
  accountId String
  status    String
  email     String
  deletedAt DateTime?

  // Unique active emails per account (exclude soft-deleted)
  @@unique([accountId, email], where: { deletedAt: null })

  // Index only active or pending account
  @@index([accountId, status], where: { status: { in: ["pending", "active"] } })

  // Sparse index, only index rows where field is non-null
  @@index([accountId, email], where: { email: { not: null } })
}

Additional context
Add any other context or screenshots about the feature request here.

Vorherrschende Sprache
TypeScript
Sterne
2.9k
Forks
157
Ø Merge
11 Std. 42 Min.
Gemergte PRs (30 T.)
20

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus zenstackhq/zenstack

Alle Issues in zenstackhq/zenstack

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.