# Suggested data model

A starting point for the tables your integration needs. Adapt the types to your database.

```sql
products(
  id uuid primary key, title text, short_description text, description text,
  status text, availability_required boolean,
  media jsonb, category_labels jsonb, locations jsonb, raw jsonb,
  listable boolean, updated_at timestamptz)

product_options(
  id uuid primary key, product_id uuid references products(id),
  title text, is_default boolean, active boolean,
  retail_minor int, original_minor int, currency text, currency_precision int,
  promo_amount_minor int, promo_code text, promo_ends_at timestamptz,
  min_units int, max_units int)

sync_state(name text primary key, last_refresh_at timestamptz)

carts(
  session_id text primary key, groupon_cart_id uuid, buy_link text,
  snapshot jsonb, purchased_order_id uuid, updated_at timestamptz)
```

A product is listable when its `status` is `active`, it does not require availability, and at
least one of its options is not inactive (`active IS DISTINCT FROM false`). See [Syncing the
catalog](/docs/syncing-the-catalog.md).
