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 tsvector column if search is needed.
- Skipping time zones. Always use timestamptz not timestamp.
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
FAQs
Can AI design for multi-tenancy? Yes — ask for row-level tenancy with a tenant_id column and RLS policy.
Will AI add RLS policies? For Supabase yes, if you mention it explicitly.
Does AI understand GDPR schema needs? It will add a deleted_at column and suggest a personal-data registry table if asked.
How should I handle JSON columns? Use jsonb for flexible fields and generated columns for indexable paths.
Can AI migrate existing schemas? Yes — paste current DDL and describe the change.
What about sharding? AI gives reasonable starting points; Citus/Vitess needs human architect review.
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.