Production Prisma schema from a feature spec
Turn a feature description into a normalized Prisma schema with relations, indexes, and migration-safe defaults.
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