Database Schema Designer
Design a complete database schema with tables, relationships, indexes, and migration scripts for your application.
The Prompt
Design a complete database schema for a [YOUR APPLICATION TYPE]. Database: [PostgreSQL / MySQL / MongoDB / SQLite] ORM: [Prisma / Drizzle / SQLAlchemy / TypeORM / none] Application description: [DESCRIBE YOUR APP'S CORE FUNCTIONALITY AND DATA NEEDS] Deliverables: 1. ENTITY LIST: - All tables/collections with descriptions - Fields: name, type, constraints (NOT NULL, UNIQUE, DEFAULT) - Primary keys and auto-increment strategy 2. RELATIONSHIPS: - One-to-one, one-to-many, many-to-many mappings - Foreign key constraints with ON DELETE/UPDATE behavior - Junction tables for many-to-many relationships 3. INDEXES: - Primary indexes (automatic) - Secondary indexes for common query patterns - Composite indexes where beneficial - Full-text search indexes if applicable 4. SEED DATA: - 5-10 realistic sample records per table - Consistent relationships across tables 5. MIGRATION SCRIPTS: - Initial schema creation SQL - ORM migration file if using an ORM - Rollback script 6. ER DIAGRAM: - Mermaid.js or ASCII diagram of all relationships 7. QUERY EXAMPLES: - 5 common queries your app will need - With JOINs, aggregations, and filters Considerations: soft deletes, timestamps (created_at, updated_at), UUID vs auto-increment, normalization level.
Tips for Best Results
- →List your main user stories so the schema covers all data needs
- →Specify expected data volume for index optimization suggestions
- →Ask for a read-optimized vs write-optimized version if unsure
Tags
Related Prompts
Full-Stack API Generator
Generate a complete REST API with database schema, authentication, CRUD operations, and documentation.
Code GenerationREST API Builder with Authentication
Generate a complete, production-ready REST API with JWT authentication, rate limiting, and full CRUD endpoints.
Code GenerationPython Web Scraper Builder
Generate a robust Python web scraper with error handling, rate limiting, and data export to CSV or JSON.
Code GenerationReact Dashboard Component Builder
Generate a complete analytics dashboard with charts, KPI cards, data tables, and filters using React and Recharts.
Code GenerationSQL Query Optimizer and Explainer
Paste any SQL query and get an optimized version with explanation of what was improved and why.
Code GenerationChrome Extension Builder
Build a functional Chrome extension with popup UI, content scripts, and background service worker from a single prompt.