Prisma Schema and Migration Template

Generate Prisma schema with models, relations, and migration patterns

6/11/2026
Prompt
Create Prisma schema for:

Application Type: {{APPLICATION_TYPE}}
Database: {{DATABASE}} (PostgreSQL/MySQL/SQLite/MongoDB)
Models Needed: {{MODELS}}

Generate complete Prisma setup:

1. **Schema (schema.prisma):**
   - Datasource configuration
   - Generator configuration
   - Model definitions
   - Field types and modifiers
   - Relations (1:1, 1:n, n:m)
   - Indexes
   - Unique constraints
   - Default values
   - Enums

2. **Model Patterns:**
   - Base model with timestamps
   - Soft delete pattern
   - Multi-tenant pattern
   - Polymorphic relations
   - Self-referential relations

3. **Client Usage (client.ts):**
   - PrismaClient instantiation
   - Connection handling
   - Logging configuration
   - Middleware setup

4. **Query Patterns:**
   - CRUD operations
   - Transactions
   - Raw queries
   - Aggregations
   - Pagination patterns

5. **Seed Script (seed.ts):**
   - Test data generation
   - Relation seeding
   - Idempotent seeding

6. **Migration Workflow:**
   - Migration commands
   - Production migration
   - Rollback patterns
   - Data migrations

7. **Type Generation:**
   - Generated types usage
   - Custom type extensions
   - Zod schema generation

8. **Performance:**
   - Select optimization
   - Include optimization
   - Connection pooling
   - Query logging

Include integration with NestJS/Next.js/Express.

Or press ⌘C to copy

Variables (3)

Replace these placeholders with your own content before using the prompt.

[{APPLICATION_TYPE][{DATABASE][{MODELS]

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...