E-commerce store database schema

A production-shaped e-commerce schema: products with variants, inventory per location, carts, orders with snapshotted line items, payments and shipments. Open it in the editor or export SQL for six dialects.

Ecommerce Store ER diagram

E-commerce store database schema n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 customers idBIGINT emailVARCHAR full_nameVARCHAR phoneVARCHAR password_hashVARCHAR accepts_marketingBOOLEAN created_atTIMESTAMP updated_atTIMESTAMP addresses idBIGINT customer_idBIGINT labelVARCHAR line1VARCHAR line2VARCHAR cityVARCHAR regionVARCHAR postal_codeVARCHAR country_codeCHAR is_defaultBOOLEAN created_atTIMESTAMP categories idBIGINT parent_idBIGINT nameVARCHAR slugVARCHAR positionINTEGER products idBIGINT category_idBIGINT nameVARCHAR slugVARCHAR descriptionTEXT statusVARCHAR created_atTIMESTAMP updated_atTIMESTAMP product_variants idBIGINT product_idBIGINT skuVARCHAR option_valuesJSON price_centsINTEGER currency_codeCHAR weight_gramsINTEGER is_activeBOOLEAN inventory_items idBIGINT variant_idBIGINT location_codeVARCHAR on_handINTEGER reservedINTEGER reorder_pointINTEGER updated_atTIMESTAMP carts idBIGINT customer_idBIGINT session_tokenVARCHAR currency_codeCHAR created_atTIMESTAMP expires_atTIMESTAMP cart_items idBIGINT cart_idBIGINT variant_idBIGINT quantityINTEGER added_atTIMESTAMP orders idBIGINT customer_idBIGINT order_numberVARCHAR statusVARCHAR currency_codeCHAR subtotal_centsINTEGER shipping_centsINTEGER tax_centsINTEGER total_centsINTEGER shipping_addressJSON billing_addressJSON placed_atTIMESTAMP cancelled_atTIMESTAMP order_items idBIGINT order_idBIGINT variant_idBIGINT skuVARCHAR nameVARCHAR quantityINTEGER unit_price_centsINTEGER total_centsINTEGER payments idBIGINT order_idBIGINT providerVARCHAR provider_referenceVARCHAR statusVARCHAR amount_centsINTEGER currency_codeCHAR created_atTIMESTAMP shipments idBIGINT order_idBIGINT carrierVARCHAR tracking_numberVARCHAR statusVARCHAR shipped_atTIMESTAMP delivered_atTIMESTAMP

Related database schemas