Skip to content

Products

Table: public.products

Columns

Column Type Default Description
id uuid PK UUID
seller_id uuid FK → sellers(id) Pharmacy
category_id uuid FK → categories(id) Category
brand_id uuid FK → brands(id) Brand
name text NOT NULL Product name
slug text nullable URL-friendly
sku text nullable Stock code
description text nullable Full description
short_description text nullable Brief
price numeric NOT NULL Selling price
discount_price numeric nullable Sale price
cost_price numeric nullable Wholesale cost
quantity integer 0 Stock count
low_stock_threshold integer nullable Alert
weight numeric nullable
dosage text nullable Medication dosage
expiry_date date nullable
manufacturer text nullable
prescription_required boolean false Rx required
is_featured boolean false Boosted
is_published boolean true Published
is_boosted boolean false Active boost
approval_status text 'pending' pending, approved, rejected
images jsonb '[]' Image URL array
rating numeric 0 Average
review_count integer 0
views integer 0 View count
sold_count integer 0 Units sold
created_at timestamptz now()
updated_at timestamptz now()

variant_options

Column Type Description
id uuid PK
product_id uuid FK
option_name text e.g. "Size"
option_position int Sort order

variant_values

Column Type Description
id uuid PK
variant_option_id uuid FK
value_name text e.g. "Small"
value_position int

variant_combinations

Column Type Description
id uuid PK
product_id uuid FK
sku text Unique SKU
price numeric Variant price
stock_quantity int Variant stock
image_url text nullable
is_active boolean

Indexes

  • idx_products_seller_id
  • idx_products_category_id
  • idx_products_approval_status
  • idx_products_published