Cursor prompt
Implement Database Schema from ERD
Generate a complete Prisma schema from entity-relationship requirements with relations, indexes, enums, and audit timestamps.
Create a complete Prisma schema from this entity-relationship specification. ## Project: {{project_name}} ## Database: {{database}} ## Entities and Relationships: {{erd_description}} ### Schema Standards **IDs and Timestamps** - All models use: id String @id @default(cuid()) - Audit timestamps: createdAt DateTime @default(now()), updatedAt DateTime @updatedAt **Field Types** - Monetary values: Decimal (never Float) - Long text: @db.Text - Enums for status fields with explicit state names - Boolean flags with explicit defaults **Relations** - Named @relation for all foreign keys - Explicit onDelete behavior on each relation — comment your reasoning - Use onDelete: Restrict for critical data, Cascade for owned child records **Indexes** - @@index on all foreign key fields - @@index on all frequently filtered fields - @@unique where business rules require it - @@map with snake_case table names for SQL convention **Performance Notes** - Note which queries each index is designed to serve - Flag any fields that may need partial indexes later ### Output 1. Complete prisma/schema.prisma with all models 2. Migration SQL equivalent 3. Index justification as inline comments 4. Seed data structure that exercises all relations
Fill in: {{project_name}}, {{database}}, {{erd_description}}. In Loopy you fill these in a form and copy the finished prompt in one click.

