Database Schema Design
Design a normalized database schema with relations, indexes, and migrations.
Prompt template
Design a professional database schema for [PROJECT DESCRIPTION]. **Requirements:** - Database system: [PostgreSQL/MySQL/MongoDB/etc.] - Estimated data volume: [ROWS/DOCUMENTS] - Key entities: [LIST OF MAIN ENTITIES] - Special requirements: [MULTI-TENANCY, SOFT-DELETE, AUDIT-LOG, etc.] **Please create:** 1. **ER Diagram:** Describe entities and their relationships in text form 2. **Table Definitions:** Complete CREATE TABLE statements with: - Appropriate data types and constraints - Primary keys and foreign keys - NOT NULL, UNIQUE, and CHECK constraints - Default values and auto-generation 3. **Indexes:** Recommended indexes based on expected queries 4. **Normalization:** Normal form and reasoning for denormalization 5. **Migrations:** SQL migration scripts for initial creation 6. **Seed Data:** Sample data for testing Consider performance, scalability, and data integrity.
Replace placeholders in [square brackets]: [PROJECT DESCRIPTION][PostgreSQL/MySQL/MongoDB/etc.][ROWS/DOCUMENTS][LIST OF MAIN ENTITIES][MULTI-TENANCY, SOFT-DELETE, AUDIT-LOG, etc.]
How to use this template
Copy the prompt, replace the placeholders in square brackets with your details and paste it into the AI assistant of your choice. The more precise your details, the better the result.
Tips for better results
- Describe the most common query patterns for appropriate indexes
- Specify whether it's OLTP or OLAP
- Ask for a partitioning strategy for large tables
- Request a TypeScript/Python ORM model as a bonus
Suitable open models
The selection names current open models as a starting point for your own tests. It is not a measurement for this template.
Keywords: #database #schema-design #sql #data-modeling