Database Schema Prompt Template
Design a normalised database schema with table definitions, relationships, indexes, and query optimisation notes.
The Prompt
Make it specific to you
PromptITIN asks a few questions and builds a version tailored to your use case.
How to use this template
Copy the template
Click the copy button to grab the full prompt text.
Fill in the placeholders
Replace anything in [BRACKETS] with your specific details.
Paste into any AI tool
Works with ChatGPT, Claude, Gemini, Cursor, and more.
Or enhance with AI
Sign in to PromptITIN and let AI tailor the prompt to your exact situation in seconds.
Why this prompt works
Requiring ON DELETE behaviour to be stated and justified is the most important safety rule in schema design — implicit cascade deletion is one of the most common causes of production data loss. Tying each index to a named query prevents index sprawl that slows writes.
Tips for best results
- Give the AI your 3 most important dashboard queries before designing the schema — working backwards from reads produces better-indexed schemas than designing top-down
- The ON DELETE decision for your most critical foreign keys should be a human decision — ask the AI to list them and explain each option before accepting its defaults
- Add 'use UUIDs for all primary keys' or 'use integer sequences' to CONSTRAINTS based on your specific needs — this changes the joins strategy significantly
- Run EXPLAIN on the generated example queries after implementing — if the AI's index suggestions don't get picked up by the planner, there's usually a type mismatch or missing cast