Design a Database Schema
Turn your app requirements into a normalized database schema with proper relations, indexes, and constraints.
10-15 min|Intermediate
BuildDeep WorkDeveloper
Prompt Template
Check my project setup (look at package.json and any existing database config) to determine my database and ORM. Then design a database schema for my app. The app needs to store: [List each entity with its key fields and relationships] Example: - Users: email, name, avatar URL, created date - Teams: name, created by (user), max seats - Team Members: user + team (many-to-many), role (admin/member), joined date - Invites: team, email, token (UUID), expires at, status (pending/accepted/expired) Requirements: - Use UUIDs for primary keys (not auto-increment) - Add created_at and updated_at timestamps to every table - Include appropriate indexes (at minimum: foreign keys, unique constraints, fields used in WHERE clauses) - Add ON DELETE behavior for every foreign key (CASCADE, SET NULL, or RESTRICT) - Note which fields should be NOT NULL vs nullable Output the schema in [Drizzle / Prisma / raw SQL] format. Add a brief comment above each table explaining what it stores." **Output format:** Complete schema code with comments.
Listing entities with their relationships prevents the AI from missing tables. The explicit index and ON DELETE requirements catch issues that cause bugs months later.
Before writing any application code. Get the data model right first.