# Design a database schema

Entities, relationships, keys, indexes, and migrations for your data model.

- Topic: Software Development
- Framework: RTF
- Level: Standard
- Tags: Write, Plan, Fill-in Template
- Source: https://www.thinkwithprompt.com/prompts/design-a-database-schema

## Prompt

```text
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.
```

## What to fill in

- DESCRIPTION
- LIST
- READ/WRITE PATTERNS
- rows, growth, concurrency
- PostgreSQL / MySQL / SQLite / MongoDB — or recommend

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
