Design a database schema
Entities, relationships, keys, indexes, and migrations for your data model.
The prompt
Design a database schema for me.
Application and what data it stores: [DESCRIPTION]
Entities and relationships: [LIST]
Main queries and their frequency: [READ/WRITE PATTERNS]
Scale: [rows, growth, concurrency]
Database: [PostgreSQL / MySQL / SQLite / MongoDB — or recommend]
Deliver:
1. An entity-relationship overview (Mermaid erDiagram).
2. Table definitions (DDL) with types, constraints, keys, and defaults.
3. Indexes, justified by the query patterns.
4. Normalization choices and any deliberate denormalization.
5. A migration plan if changing an existing schema (safe, reversible steps).
6. Data integrity, privacy (PII fields), and retention considerations.
7. Queries for the top 3 use cases.
Highlighted [brackets] are blanks to replace with your own details.
Fill in the blanks and use this promptMore Software Development prompts
What to fill in
- DESCRIPTION
- LIST
- READ/WRITE PATTERNS
- rows, growth, concurrency
- PostgreSQL / MySQL / SQLite / MongoDB — or recommend
How this prompt is built
This prompt follows the RTF structure (Role, Task, Format). RTF tells the model who to be, what to do and what shape the answer should take. It is the quickest structure that still gives noticeably better results than a bare request.
Related prompts
- Refactor code to be cleaner and easier to maintainImproves structure, naming, and design without changing behavior.
- Plan a zero-downtime database migrationCreates a step-by-step expand-and-contract plan for a schema or data change, with backfill, verification, and rollback at each step.
- Design a caching strategy with safe invalidationDecides what to cache, where, and for how long, with invalidation rules and failure modes so the cache doesn't serve wrong data.
- Audit a codebase for bugs, risks, and tech debtA systematic review of a repository with prioritized findings and a remediation plan.