Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucassmacedo/d3879b06443f256932cbea7f62df2d8a to your computer and use it in GitHub Desktop.
Save lucassmacedo/d3879b06443f256932cbea7f62df2d8a to your computer and use it in GitHub Desktop.
Product/Color/Size
products:
------------------
| id | name |
------------------
| 1 | t-shirt |
------------------
variants:
------------------------------
| id | product_id | name |
------------------------------
| 1 | 1 | size |
------------------------------
| 2 | 1 | color |
----------------------------
variant_options:
---------------------------------------------
| id | product_id | variant_id | name |
---------------------------------------------
| 1 | 1 | 1 | small |
---------------------------------------------
| 2 | 1 | 1 | large |
----------------------------------------------
| 3 | 1 | 2 | red |
---------------------------------------------
| 4 | 1 | 2 | blue |
----------------------------------------------
skus:
-----------------------------------------------
| id | product_id | sku | price | qty |
------------------------------------------------
| 1 | 1 | 4xx01 | 140 | 5 |
------------------------------------------------
| 2 | 1 | 4xx02 | 140 | 10 |
------------------------------------------------
| 3 | 1 | 4xx03 | 160 | 8 |
------------------------------------------------
| 4 | 1 | 4xx04 | 160 | 15 |
sku_values:
----------------------------------------------------------------------
| id | product_id | variant_id | variant_option_id | skud_id |
-----------------------------------------------------------------------
| 1 | 1 | 1 | 1 | 1 |
-----------------------------------------------------------------------
| 2 | 1 | 2 | 3 | 1 |
-----------------------------------------------------------------------
| 3 | 1 | 1 | 1 | 2 |
-----------------------------------------------------------------------
| 4 | 1 | 2 | 4 | 2 |
-----------------------------------------------------------------------
| 5 | 1 | 1 | 2 | 3 |
-----------------------------------------------------------------------
| 6 | 1 | 2 | 3 | 3 |
-----------------------------------------------------------------------
| 7 | 1 | 1 | 2 | 4 |
-----------------------------------------------------------------------
| 8 | 1 | 2 | 4 | 3 |
-----------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment