---
# System prepended metadata

title: COGS dll

---

# Tier, Membership, Discount & COGS
## Tier
### Tables
**product_variant_tier_quantities**

| Name               | Type         | Desc       |
| ------------------ | ------------ |:---------- |
| product_variant_id | int          | index      |
| code               | varchar(255) | index uniq |
| name               | varchar(255) |            |
| min_qty            | int          |            |
| max_qty            | int          |            |
| margin             | decimal(5,2) |            |

## Membership & Discount
**memberships**

| Name                     | Type         | Desc          |
|:------------------------ | ------------ | ------------- |
| code                     | varchar(255) | index uniq    |
| name                     | varchar(255) | index         |
| discount_percentage     | int          |               |
| commisions_percentage    | int          |               |
| is_discount_customable   | bool         | default: true |
| is_commission_customable | bool         | default:true  |

**product_variant_memberships**

| Name                 | Type | Desc  |
|:-------------------- | ---- | ----- |
| membership_id        | int  | index |
| product_variant_id   | int  | index |
| discount_percentage  | int  |       |
| commisions_percentage | int  |       |

**delivery_options**

| Name      | Type         | Desc                        |
| --------- | ------------ |:--------------------------- |
| name      | jsonb        | default: {"id":"", "en":""} |
| code      | varchar(255) | index uniq                  |
| is_active | bool         | index default:true          |

**product_type_service_times**


| Name                  | Type          | Desc  |
| --------------------- |:------------- |:----- |
| product_type_id       | int           | index |
| delivery_option_id    | int           | index |
| duration              | int           |       |
| additional_percentage | int           |       |
| min_charge            | decimal(14,2) |       |
| max_charge            | decimal(14,2) |       |

**product_variant_service_times**


| Name                  | Type          | Desc  |
|:--------------------- |:------------- |:----- |
| product_variant_id    | int           | index |
| delivery_option_name  | varchar(255)  |       |
| duration              | int           |       |
| additional_percentage | int           |       |
| min_charge            | decimal(14,2) |       |
| max_charge            | decimal(14,2) |       |

## SKU
**product_skus**

| column_name         | data_type               | desc       |
| ------------------- |:----------------------- | ---------- |
| product_variant_id  | int                     | index      |
| sku_code            | varchar(255)            | index uniq |
| is_active           | bool                    | index      |
| spec_set (new)      | jsonb                   | index      |
| is_custom     (new) | bool                    | index      |
| deleted_at          | timestamp with timezone | index      |

**product_sku_specs**

| Column 1       | Column 2                          | Column 3 |
|:-------------- | --------------------------------- |:-------- |
| product_sku_id | int                               | index    |
| spec_key_id    | int                               | index    |
| spec_value_id  | int (nullable)                    | index    |
| position       | int                               |          |
| custom   (new) | jsonb { "width": 7, "length": 7 } | index    |
| deleted_at     | timestamp with timezone           | index    |

## COGS

**product_variants**


| Name         | Type         | Desc                   |
| ------------ | ------------ |:---------------------- |
| ---          | ---          | ---                    |
| price_method | varchar(255) | 'manual', 'calculator' |


**product_variant_sku_prices**


| Name                     | Type                    | Desc  |
| ------------------------ | ----------------------- | ----- |
| product_sku_id           | int                     | index |
| min_qty                  | int                     |       |
| max_qty                  | int                     |       |
| cogs                     | decimal(14,2)           |       |
| speed_in_hours           | decimal(4,1)            |       |
| expired_at               | timestamp with timezone |       |



