Как моделировать связи в Prisma?

Middle
311 просмотров
AFK Offer AI

One-to-many: User { posts Post[] }, Post { author User @relation(fields: [authorId], references: [id]); authorId String }. Many-to-many: Post { tags Tag[] }, Tag { posts Post[] } — Prisma создаёт junction table автоматически. Explicit many-to-many с доп полями: отдельная join модель. One-to-one: User { profile Profile? }, Profile { user User @relation(...) }. Self-relations для иерархий: Employee { manager Employee? reportsTo String? reports Employee[] }. Cascade delete: onDelete: Cascade.

Следующий вопрос

Как реализовать Retry паттерн в Node.js?