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)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| product_id | uuid | not null, references products.id | |
| sku | varchar(64) | unique, not null | |
| barcode | varchar(64) | ||
| price_cents | integer | not null | |
| compare_at_cents | integer | ||
| currency | char(3) | not null | |
| weight_grams | integer | ||
| requires_shipping | boolean | not null | |
| is_active | boolean | not null |
Indexes (1)
(product_id, is_active)
Relationships
product_variants.product_idreferencesproducts.idwishlist_items.variant_idreferencesproduct_variantsvariant_option_values.variant_idreferencesproduct_variantsproduct_images.variant_idreferencesproduct_variantsinventory_items.variant_idreferencesproduct_variantscart_items.variant_idreferencesproduct_variantsorder_lines.variant_idreferencesproduct_variants