[Feature Request] Partial indexes
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 15/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- sql, typescript
- Lĩnh vực
- databases
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.9k
- Fork
- 157
- Merge trung bình
- 11 giờ 42 phút
- Pull request đã merge (30 ngày)
- 20
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của zenstackhq/zenstack
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
zenstackhq/zenstack#2873 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
runtime
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zenstackhq/zenstack#2868 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
zenstackhq/zenstack#2694 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
zenstackhq/zenstack#2659 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
zenstackhq/zenstack#2542 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của zenstackhq/zenstack
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
siyuan-note/siyuan#20313 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
alunduil/projects-v2-sync#14 ·
-
Service process inherits the caller's cwd at first use, holding that folder open on Windows (EBUSY)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
DevTools page styles leak into the host app in developmentCó thể đã có người làm @onmax đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
nuxt-modules/better-auth#567 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày