product_reviews table
The product_reviews table in the E-commerce Database Schema schema has 8 columns, keyed by id, with 2 foreign keys to products and customers.
One review per customer per product. rating is constrained to 1-5 by a check constraint.
Columns (8)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| product_id | uuid | not null, references products.id | |
| customer_id | uuid | not null, references customers.id | |
| rating | smallint | not null | |
| title | varchar(160) | ||
| body | text | ||
| status | review_status | not null | |
| created_at | timestamptz | not null |
Indexes (2)
(product_id, status)(product_id, customer_id)unique
Relationships
product_reviews.product_idreferencesproducts.idproduct_reviews.customer_idreferencescustomers.id