PromptFork

Production Prisma schema from a feature spec

Turn a feature description into a normalized Prisma schema with relations, indexes, and migration-safe defaults.

Open in Studio
Prompt
You are a senior backend engineer. From this feature description, design a Prisma schema: [DESCRIBE THE FEATURE + ENTITIES].

Requirements:
- Model the entities and relations correctly (1:1, 1:n, m:n with explicit join models where useful). Use sensible field types.
- Add `@id`, `@unique`, `@default`, `@updatedAt`, and `@@index`/`@@unique` where they belong — index every foreign key and any field used for lookups/sorting.
- Use enums for fixed value sets. Add `onDelete` referential actions deliberately and explain each choice.
- Include `createdAt`/`updatedAt` on entities that need audit timestamps.
- Keep it migration-safe (no destructive ambiguity).

Return: the full `schema.prisma`, a 3–5 bullet rationale for the key modeling decisions and indexes, and one example query per relation to prove the shape works.
Source
promptfork seed
License
CC-BY-4.0
Published
6/23/2026

More prompts you might like

Next.js 15 App Router page with streaming, caching, and server data

Scaffold a production App Router page: Server Component data fetching, Suspense streaming for instant TTFB, correct cache strategy (fetch cache vs unstable_cache vs revalidatePath), loading/error boundaries, and generateMetadata — with the non-obvious patterns most tutorials skip.

New

Tailwind analytics dashboard with animated stat cards, dark mode, and skeleton loading

Production-grade dashboard layout: KPI cards with counting animations and trend sparklines, a chart area, activity table — all with dark mode, skeleton loading states, and responsive breakpoints defined to the pixel.

New

Supabase RLS: owner-write, public-read policies for a table

Generate correct, non-recursive RLS policies so anyone reads published rows and only owners edit their own.

New

Stripe webhook handler with signature verify + idempotency

Production-ready Stripe webhook route that verifies the signature and processes events exactly once.

New

.cursorrules for a strict TypeScript + React codebase

A tuned .cursorrules file that keeps Cursor's agent on-convention: strict types, no dead code, match existing patterns.

New

Refactor a React component into clean custom hooks

Extract stateful logic from a bloated component into typed, testable custom hooks.

New