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)

Columns of the cart_items table
ColumnTypeConstraintsDescription
iduuidprimary key
cart_iduuidnot null, references carts.id
variant_iduuidnot null, references product_variants.id
quantityintegernot null
added_attimestamptznot null

Indexes (1)

  • (cart_id, variant_id) unique

Relationships