Design a database schema for an e-commerce platform:
- Entities: users, products, categories, orders, order_items, addresses
- Relationships: users have many orders and addresses, products belong to categories, orders contain multiple products
- Constraints: email uniqueness, positive prices, valid order statuses
- Indexes: optimize for user lookups, product searches, and order queries
Use PostgreSQL and include migration scripts.
This template helps you design robust database schemas with proper relationships, constraints, and performance considerations. It ensures your database structure is scalable, maintainable, and follows industry best practices.
peep database-schema