Data Model
Core tables
Section titled “Core tables”Products
Section titled “Products”products— product catalogueproduct_variants— size/colour variationsproduct_images— product mediaproduct_categories— category definitionsproduct_category_relations— product-category links
Customers
Section titled “Customers”customers— customer accountsaddresses— customer addresses
Orders
Section titled “Orders”orders— order headersorder_items— line itemsfulfillments— shipping fulfillmentspayments— payment records
carts— shopping cartscart_items— cart line items
coupons— discount codesapi_keys— API authenticationwebhooks— webhook configurationsaudit_logs— audit trail
Key relationships
Section titled “Key relationships”products 1──N product_variantsproducts N──N product_categoriescustomers 1──N addressescustomers 1──N ordersorders 1──N order_itemsorders 1──N fulfillmentsorders 1──N paymentscarts 1──N cart_itemsPostgreSQL types
Section titled “PostgreSQL types”Custom enum types:
CREATE TYPE currency AS ENUM ('USD', 'EUR', 'GBP', 'JPY', 'AUD', 'CAD', 'CNY', 'HKD', 'SGD');CREATE TYPE order_status AS ENUM ('pending', 'confirmed', 'processing', 'on_hold', 'completed', 'cancelled', 'refunded');CREATE TYPE fulfillment_status AS ENUM ('pending', 'processing', 'partial', 'shipped', 'delivered', 'cancelled', 'returned');CREATE TYPE payment_status AS ENUM ('pending', 'authorized', 'paid', 'failed', 'cancelled', 'refunded');Migrations
Section titled “Migrations”Migrations run automatically on startup. Schema changes are in crates/rcommerce-core/migrations/.