cart_items table
The cart_items table in the E-commerce Database Schema schema has 5 columns, keyed by id, with 2 foreign keys to carts and product_variants.
No price column on purpose. A cart always reprices against the live variant.
Columns (5)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| cart_id | uuid | not null, references carts.id | |
| variant_id | uuid | not null, references product_variants.id | |
| quantity | integer | not null | |
| added_at | timestamptz | not null |
Indexes (1)
(cart_id, variant_id)unique
Relationships
cart_items.cart_idreferencescarts.idcart_items.variant_idreferencesproduct_variants.id