product_variants table

The product_variants table in the E-commerce Database Schema schema has 10 columns, keyed by id, with 1 foreign key to products. 6 columns in wishlist_items, variant_option_values, product_images, inventory_items and 2 more reference it.

The sellable, stockable unit. Carts, orders and inventory all reference this, never products.

Columns (10)

Columns of the product_variants table
ColumnTypeConstraintsDescription
iduuidprimary key
product_iduuidnot null, references products.id
skuvarchar(64)unique, not null
barcodevarchar(64)
price_centsintegernot null
compare_at_centsinteger
currencychar(3)not null
weight_gramsinteger
requires_shippingbooleannot null
is_activebooleannot null

Indexes (1)

  • (product_id, is_active)

Relationships