Prisma ORM patterns — schema design, migrations, type-safe queries, testing, error handling, and performance
96
95%
Does it follow best practices?
Impact
100%
1.28xAverage score across 3 eval scenarios
Passed
No known issues
A small café chain is launching an online ordering platform. Customers will be able to browse a menu of products (drinks and pastries), place orders with multiple items, and track their order status through a fulfillment workflow. The team is starting fresh with Prisma and PostgreSQL.
The backend team has sketched out the domain: there are products (with a category and price), orders (each belonging to a customer, with a lifecycle status), and order line items linking orders to products with a quantity and per-item price captured at the time of purchase. Products can be listed and filtered by category frequently. Orders are frequently filtered by their status and by when they were placed.
Your task is to design and write the complete Prisma schema for this system. The schema must be production-ready: suitable for a real PostgreSQL database, with proper types for all fields, and correctly modeling the relationships between entities.
Produce a single file prisma/schema.prisma containing the complete Prisma schema. The schema should:
Do not include any application code — only the schema file.