Table of Contents
Quick Answer
Describe your domain entities and relationships to AI, and it will produce a normalized schema, ERD diagram, and migration files. Always review for 3NF compliance and check for missing indexes.
- Start with user stories; derive entities from nouns
- AI is strong at 3NF normalization; weak at denormalization decisions
- Always add created_at, updated_at, and deletion strategy to every table
What You'll Need
- Product requirements or user stories
- Target database (Postgres recommended)
- AI tool with diagram support (Claude, ChatGPT)
- Migration runner (Prisma, Drizzle, Supabase, Liquibase)
Steps
- Describe the domain. Prompt:
I'm building a blog platform with authors, posts, comments, and tags. Design a PostgreSQL schema. - Request an ERD. Ask:
Produce a Mermaid erDiagram for this schema. - Normalize to 3NF. Prompt:
Is this schema in 3rd normal form? Fix any violations. - Identify access patterns. List read/write patterns. Ask:
Suggest indexes for these queries. - Generate migration files. For Prisma:
Convert this to a Prisma schema file. - Add audit columns. Ensure every table has
created_at,updated_at, and soft-delete if needed. - Plan for scale. Ask:
Which tables will grow fastest? Suggest partitioning strategy.
Common Mistakes
- Over-normalizing. 4NF/5NF rarely helps OLTP workloads.
- Missing foreign key indexes. Postgres does not auto-index FKs.
- No text search strategy. Add
tsvectorcolumn if search is needed. - Skipping time zones. Always use
timestamptznottimestamp.
Top Tools
| Tool | Use |
|---|---|
| ChatGPT / Claude | Schema + ERD |
| dbdiagram.io | Visual ERD + DBML |
| Prisma | Migration codegen from schema |
| Drizzle | TS-first migration tool |
| Supabase Studio | Visual schema + RLS |
Conclusion
AI-assisted schema design gives you a normalized, indexed starting point in minutes. Always human-review for access patterns and compliance. Use Misar Dev with Supabase to spin up a fully-seeded schema in under 5 minutes.