spina-shop 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/config/spina_shop_manifest.js +0 -0
  6. data/app/assets/fonts/montserrat-bold.ttf +0 -0
  7. data/app/assets/fonts/montserrat-italic.ttf +0 -0
  8. data/app/assets/fonts/montserrat-medium.ttf +0 -0
  9. data/app/assets/fonts/montserrat-regular.ttf +0 -0
  10. data/app/assets/fonts/montserrat-semibold.ttf +0 -0
  11. data/app/assets/images/spina/shop/delete-big-confirm.png +0 -0
  12. data/app/assets/images/spina/shop/delete-big.png +0 -0
  13. data/app/assets/javascripts/spina/shop/admin/app.infinitescroll.js.coffee +23 -0
  14. data/app/assets/javascripts/spina/shop/admin/customers.coffee +27 -0
  15. data/app/assets/javascripts/spina/shop/admin/orders.coffee +18 -0
  16. data/app/assets/javascripts/spina/shop/admin/product_bundles.coffee +15 -0
  17. data/app/assets/javascripts/spina/shop/admin/product_categories.coffee +15 -0
  18. data/app/assets/javascripts/spina/shop/admin/products.coffee +88 -0
  19. data/app/assets/javascripts/spina/shop/admin/shop.js +10 -0
  20. data/app/assets/stylesheets/spina/shop/admin/_customers.sass +10 -0
  21. data/app/assets/stylesheets/spina/shop/admin/_forms.sass +191 -0
  22. data/app/assets/stylesheets/spina/shop/admin/_product_bundles.sass +12 -0
  23. data/app/assets/stylesheets/spina/shop/admin/_status_dots.sass +16 -0
  24. data/app/assets/stylesheets/spina/shop/admin/_tables.sass +2 -0
  25. data/app/assets/stylesheets/spina/shop/admin/_tooltips.sass +31 -0
  26. data/app/assets/stylesheets/spina/shop/admin/shop.css.sass +11 -0
  27. data/app/controllers/spina/shop/admin/admin_controller.rb +8 -0
  28. data/app/controllers/spina/shop/admin/customer_accounts_controller.rb +38 -0
  29. data/app/controllers/spina/shop/admin/customers_controller.rb +67 -0
  30. data/app/controllers/spina/shop/admin/discounts_controller.rb +65 -0
  31. data/app/controllers/spina/shop/admin/gift_cards_controller.rb +65 -0
  32. data/app/controllers/spina/shop/admin/invoices_controller.rb +12 -0
  33. data/app/controllers/spina/shop/admin/order_items_controller.rb +36 -0
  34. data/app/controllers/spina/shop/admin/orders/packing_slips_controller.rb +27 -0
  35. data/app/controllers/spina/shop/admin/orders/shipping_labels_controller.rb +19 -0
  36. data/app/controllers/spina/shop/admin/orders_controller.rb +123 -0
  37. data/app/controllers/spina/shop/admin/product_reviews_controller.rb +17 -0
  38. data/app/controllers/spina/shop/admin/products/product_bundles_controller.rb +62 -0
  39. data/app/controllers/spina/shop/admin/products/stock_forecasts_controller.rb +15 -0
  40. data/app/controllers/spina/shop/admin/products/stock_level_adjustments_controller.rb +33 -0
  41. data/app/controllers/spina/shop/admin/products_controller.rb +135 -0
  42. data/app/controllers/spina/shop/admin/reports_controller.rb +33 -0
  43. data/app/controllers/spina/shop/admin/settings/product_categories_controller.rb +45 -0
  44. data/app/controllers/spina/shop/admin/settings/product_category_properties_controller.rb +49 -0
  45. data/app/controllers/spina/shop/admin/settings/sales_categories_controller.rb +14 -0
  46. data/app/controllers/spina/shop/admin/settings/shop_controller.rb +9 -0
  47. data/app/controllers/spina/shop/admin/settings/tax_groups_controller.rb +47 -0
  48. data/app/controllers/spina/shop/admin/variants_controller.rb +8 -0
  49. data/app/jobs/spina/shop/in_stock_reminder_job.rb +17 -0
  50. data/app/jobs/spina/shop/invoice_report_job.rb +23 -0
  51. data/app/jobs/spina/shop/payments_report_job.rb +23 -0
  52. data/app/mailers/spina/shop/customer_account_mailer.rb +32 -0
  53. data/app/mailers/spina/shop/export_mailer.rb +22 -0
  54. data/app/mailers/spina/shop/in_stock_reminder_mailer.rb +22 -0
  55. data/app/mailers/spina/shop/order_mailer.rb +32 -0
  56. data/app/models/concerns/spina/shop/preferable.rb +27 -0
  57. data/app/models/concerns/spina/shop/tax_rateable.rb +11 -0
  58. data/app/models/spina/shop/address.rb +19 -0
  59. data/app/models/spina/shop/application_record.rb +5 -0
  60. data/app/models/spina/shop/bundled_product.rb +6 -0
  61. data/app/models/spina/shop/campaign.rb +4 -0
  62. data/app/models/spina/shop/collectable.rb +8 -0
  63. data/app/models/spina/shop/country.rb +5 -0
  64. data/app/models/spina/shop/customer.rb +60 -0
  65. data/app/models/spina/shop/customer_account.rb +15 -0
  66. data/app/models/spina/shop/customer_group.rb +9 -0
  67. data/app/models/spina/shop/delivery_option.rb +27 -0
  68. data/app/models/spina/shop/discount.rb +39 -0
  69. data/app/models/spina/shop/discount_action.rb +16 -0
  70. data/app/models/spina/shop/discount_rule.rb +17 -0
  71. data/app/models/spina/shop/discounts/actions/percent_off.rb +17 -0
  72. data/app/models/spina/shop/discounts/rules/all_orders.rb +13 -0
  73. data/app/models/spina/shop/discounts/rules/collection.rb +14 -0
  74. data/app/models/spina/shop/discounts/rules/order_total.rb +17 -0
  75. data/app/models/spina/shop/discounts_order.rb +6 -0
  76. data/app/models/spina/shop/favorite.rb +8 -0
  77. data/app/models/spina/shop/gift_card.rb +53 -0
  78. data/app/models/spina/shop/gift_cards_order.rb +6 -0
  79. data/app/models/spina/shop/in_stock_reminder.rb +7 -0
  80. data/app/models/spina/shop/invoice.rb +49 -0
  81. data/app/models/spina/shop/invoice_line.rb +13 -0
  82. data/app/models/spina/shop/number_sequence.rb +19 -0
  83. data/app/models/spina/shop/order.rb +222 -0
  84. data/app/models/spina/shop/order/billing.rb +85 -0
  85. data/app/models/spina/shop/order/state_machine_transitions.rb +106 -0
  86. data/app/models/spina/shop/order_attachment.rb +9 -0
  87. data/app/models/spina/shop/order_item.rb +101 -0
  88. data/app/models/spina/shop/order_transition.rb +5 -0
  89. data/app/models/spina/shop/product.rb +227 -0
  90. data/app/models/spina/shop/product_bundle.rb +51 -0
  91. data/app/models/spina/shop/product_bundle_part.rb +13 -0
  92. data/app/models/spina/shop/product_category.rb +18 -0
  93. data/app/models/spina/shop/product_category_property.rb +14 -0
  94. data/app/models/spina/shop/product_collection.rb +8 -0
  95. data/app/models/spina/shop/product_image.rb +18 -0
  96. data/app/models/spina/shop/product_item.rb +93 -0
  97. data/app/models/spina/shop/product_part.rb +13 -0
  98. data/app/models/spina/shop/product_relation.rb +6 -0
  99. data/app/models/spina/shop/product_review.rb +22 -0
  100. data/app/models/spina/shop/property_option.rb +16 -0
  101. data/app/models/spina/shop/sales_category.rb +43 -0
  102. data/app/models/spina/shop/sales_category_code.rb +20 -0
  103. data/app/models/spina/shop/shop_review.rb +19 -0
  104. data/app/models/spina/shop/stock_level_adjustment.rb +17 -0
  105. data/app/models/spina/shop/tax_group.rb +62 -0
  106. data/app/models/spina/shop/tax_rate.rb +20 -0
  107. data/app/models/spina/shop/zone.rb +11 -0
  108. data/app/pdfs/spina/shop/invoice_pdf.rb +114 -0
  109. data/app/pdfs/spina/shop/packing_slip_pdf.rb +74 -0
  110. data/app/presenters/spina/shop/invoice_presenter.rb +30 -0
  111. data/app/services/spina/shop/allocate_stock.rb +42 -0
  112. data/app/services/spina/shop/cache_order.rb +47 -0
  113. data/app/services/spina/shop/change_stock_level.rb +38 -0
  114. data/app/services/spina/shop/country_importer.rb +14 -0
  115. data/app/services/spina/shop/customer_generator.rb +32 -0
  116. data/app/services/spina/shop/deallocate_stock.rb +17 -0
  117. data/app/services/spina/shop/invoice_generator.rb +72 -0
  118. data/app/services/spina/shop/invoice_number_generator.rb +10 -0
  119. data/app/services/spina/shop/invoices_pdfs_exporter.rb +22 -0
  120. data/app/services/spina/shop/order_number_generator.rb +10 -0
  121. data/app/services/spina/shop/payments_excel_exporter.rb +41 -0
  122. data/app/services/spina/shop/store_address.rb +23 -0
  123. data/app/state_machines/spina/shop/order_state_machine.rb +116 -0
  124. data/app/uploaders/spina/shop/exports_uploader.rb +9 -0
  125. data/app/views/layouts/spina/shop/admin/settings/shop.html.haml +16 -0
  126. data/app/views/layouts/spina/shop/mail.html.erb +1 -0
  127. data/app/views/spina/admin/hooks/shop/_head.html.haml +2 -0
  128. data/app/views/spina/admin/hooks/shop/_primary_navigation.html.haml +31 -0
  129. data/app/views/spina/admin/hooks/shop/_settings_secondary_navigation.html.haml +2 -0
  130. data/app/views/spina/admin/page_partables/shop/product_bundle_parts/_form.html.haml +6 -0
  131. data/app/views/spina/admin/page_partables/shop/product_parts/_form.html.haml +6 -0
  132. data/app/views/spina/admin/structure_partables/shop/product_parts/_form.html.haml +3 -0
  133. data/app/views/spina/shop/admin/customer_accounts/_form.html.haml +32 -0
  134. data/app/views/spina/shop/admin/customer_accounts/edit.html.haml +1 -0
  135. data/app/views/spina/shop/admin/customers/_address_fields.html.haml +46 -0
  136. data/app/views/spina/shop/admin/customers/_customer.html.haml +11 -0
  137. data/app/views/spina/shop/admin/customers/_form.html.haml +67 -0
  138. data/app/views/spina/shop/admin/customers/edit.html.haml +1 -0
  139. data/app/views/spina/shop/admin/customers/index.html.haml +52 -0
  140. data/app/views/spina/shop/admin/customers/index.js.erb +4 -0
  141. data/app/views/spina/shop/admin/customers/new.html.haml +1 -0
  142. data/app/views/spina/shop/admin/customers/show.html.haml +121 -0
  143. data/app/views/spina/shop/admin/discounts/_form.html.haml +60 -0
  144. data/app/views/spina/shop/admin/discounts/edit.html.haml +1 -0
  145. data/app/views/spina/shop/admin/discounts/fields/_all_orders.html.haml +0 -0
  146. data/app/views/spina/shop/admin/discounts/fields/_discount_action_fields.html.haml +8 -0
  147. data/app/views/spina/shop/admin/discounts/fields/_discount_rule_fields.html.haml +0 -0
  148. data/app/views/spina/shop/admin/discounts/index.html.haml +36 -0
  149. data/app/views/spina/shop/admin/discounts/new.html.haml +1 -0
  150. data/app/views/spina/shop/admin/gift_cards/_form.html.haml +28 -0
  151. data/app/views/spina/shop/admin/gift_cards/_gift_card.html.haml +17 -0
  152. data/app/views/spina/shop/admin/gift_cards/index.html.haml +37 -0
  153. data/app/views/spina/shop/admin/gift_cards/index.js.erb +4 -0
  154. data/app/views/spina/shop/admin/gift_cards/new.html.haml +1 -0
  155. data/app/views/spina/shop/admin/gift_cards/show.html.haml +46 -0
  156. data/app/views/spina/shop/admin/order_items/_modal.html.haml +18 -0
  157. data/app/views/spina/shop/admin/order_items/new.js.erb +2 -0
  158. data/app/views/spina/shop/admin/orders/_form.html.haml +159 -0
  159. data/app/views/spina/shop/admin/orders/_order.html.haml +22 -0
  160. data/app/views/spina/shop/admin/orders/edit.html.haml +1 -0
  161. data/app/views/spina/shop/admin/orders/index.html.haml +78 -0
  162. data/app/views/spina/shop/admin/orders/index.js.erb +4 -0
  163. data/app/views/spina/shop/admin/orders/new.html.haml +1 -0
  164. data/app/views/spina/shop/admin/orders/show.html.haml +338 -0
  165. data/app/views/spina/shop/admin/product_reviews/_product_review.html.haml +22 -0
  166. data/app/views/spina/shop/admin/product_reviews/index.html.haml +29 -0
  167. data/app/views/spina/shop/admin/product_reviews/index.js.erb +4 -0
  168. data/app/views/spina/shop/admin/products/_form.html.haml +259 -0
  169. data/app/views/spina/shop/admin/products/_new_product_modal.html.haml +15 -0
  170. data/app/views/spina/shop/admin/products/_price_exception_fields.html.haml +11 -0
  171. data/app/views/spina/shop/admin/products/_product.html.haml +36 -0
  172. data/app/views/spina/shop/admin/products/edit.html.haml +1 -0
  173. data/app/views/spina/shop/admin/products/index.html.haml +73 -0
  174. data/app/views/spina/shop/admin/products/index.js.erb +4 -0
  175. data/app/views/spina/shop/admin/products/new.html.haml +1 -0
  176. data/app/views/spina/shop/admin/products/new_by_category.js.erb +1 -0
  177. data/app/views/spina/shop/admin/products/product_bundles/_bundled_products_fields.html.haml +11 -0
  178. data/app/views/spina/shop/admin/products/product_bundles/_form.html.haml +64 -0
  179. data/app/views/spina/shop/admin/products/product_bundles/edit.html.haml +1 -0
  180. data/app/views/spina/shop/admin/products/product_bundles/index.html.haml +42 -0
  181. data/app/views/spina/shop/admin/products/product_bundles/new.html.haml +1 -0
  182. data/app/views/spina/shop/admin/products/properties/_property_fields.html.haml +37 -0
  183. data/app/views/spina/shop/admin/products/stock_forecasts/_product.html.haml +49 -0
  184. data/app/views/spina/shop/admin/products/stock_forecasts/show.html.haml +47 -0
  185. data/app/views/spina/shop/admin/products/stock_forecasts/show.js.erb +4 -0
  186. data/app/views/spina/shop/admin/products/stock_level_adjustments/_form.html.haml +37 -0
  187. data/app/views/spina/shop/admin/products/stock_level_adjustments/_history.html.haml +30 -0
  188. data/app/views/spina/shop/admin/products/stock_level_adjustments/index.js.erb +1 -0
  189. data/app/views/spina/shop/admin/products/stock_level_adjustments/new.js.erb +1 -0
  190. data/app/views/spina/shop/admin/reports/index.html.haml +23 -0
  191. data/app/views/spina/shop/admin/settings/product_categories/_form.html.haml +18 -0
  192. data/app/views/spina/shop/admin/settings/product_categories/_product_category.html.haml +3 -0
  193. data/app/views/spina/shop/admin/settings/product_categories/_property_fields.html.haml +77 -0
  194. data/app/views/spina/shop/admin/settings/product_categories/edit.html.haml +1 -0
  195. data/app/views/spina/shop/admin/settings/product_categories/index.html.haml +3 -0
  196. data/app/views/spina/shop/admin/settings/product_categories/show.html.haml +24 -0
  197. data/app/views/spina/shop/admin/settings/product_category_properties/_property_options_fields.html.haml +11 -0
  198. data/app/views/spina/shop/admin/settings/product_category_properties/edit_options.html.haml +16 -0
  199. data/app/views/spina/shop/admin/settings/sales_categories/_sales_category.html.haml +17 -0
  200. data/app/views/spina/shop/admin/settings/sales_categories/index.html.haml +1 -0
  201. data/app/views/spina/shop/admin/settings/tax_groups/_form.html.haml +19 -0
  202. data/app/views/spina/shop/admin/settings/tax_groups/_tax_group.html.haml +21 -0
  203. data/app/views/spina/shop/admin/settings/tax_groups/index.html.haml +1 -0
  204. data/app/views/spina/shop/admin/settings/tax_groups/new.js.erb +1 -0
  205. data/app/views/spina/shop/admin/shared/_locale_switcher.html.haml +9 -0
  206. data/app/views/spina/shop/customer_account_mailer/forgot_password.html.erb +1 -0
  207. data/app/views/spina/shop/customer_account_mailer/forgot_password.txt.erb +1 -0
  208. data/app/views/spina/shop/export_mailer/exported.html.erb +2 -0
  209. data/app/views/spina/shop/in_stock_reminder_mailer/reminder.html.erb +1 -0
  210. data/app/views/spina/shop/in_stock_reminder_mailer/reminder.txt.erb +1 -0
  211. data/app/views/spina/shop/order_mailer/confirmation.html.erb +5 -0
  212. data/app/views/spina/shop/order_mailer/confirmation.txt.erb +5 -0
  213. data/app/views/spina/shop/order_mailer/shipped.html.erb +1 -0
  214. data/app/views/spina/shop/order_mailer/shipped.txt.erb +1 -0
  215. data/config/initializers/kaminari_monkey_patch.rb +15 -0
  216. data/config/locales/en.yml +214 -0
  217. data/config/locales/nl.yml +452 -0
  218. data/config/routes.rb +92 -0
  219. data/db/countries.txt +252 -0
  220. data/db/migrate/10_create_spina_shop_products_without_items.rb +23 -0
  221. data/db/migrate/1_create_spina_shop_tables.rb +518 -0
  222. data/db/migrate/20170701135207_create_spina_shop_bundled_products.rb +11 -0
  223. data/db/migrate/20170717125930_add_stock_enabled_to_spina_shop_products.rb +5 -0
  224. data/db/migrate/20170718084146_add_editable_sku_to_spina_shop_products.rb +5 -0
  225. data/db/migrate/20170718084626_add_deletable_to_spina_shop_products.rb +5 -0
  226. data/db/migrate/20170719082531_rename_column_order_picked_at_in_spina_shop_orders.rb +5 -0
  227. data/db/migrate/20170719112920_create_spina_shop_order_attachments.rb +15 -0
  228. data/db/migrate/20170719184125_add_price_exceptions_to_spina_shop_products.rb +5 -0
  229. data/db/migrate/20170720133304_add_vat_id_to_spina_shop_customers.rb +5 -0
  230. data/db/migrate/20170731082027_add_price_includes_tax_to_spina_shop_products.rb +5 -0
  231. data/db/migrate/20170731132620_add_reverse_charge_vat_to_spina_shop_tax_rates.rb +5 -0
  232. data/db/migrate/20170731150630_add_vat_id_to_spina_shop_invoices.rb +5 -0
  233. data/db/migrate/20170801093935_add_price_includes_tax_to_spina_shop_delivery_options.rb +5 -0
  234. data/db/migrate/20170814092924_add_business_to_spina_shop_orders.rb +6 -0
  235. data/db/migrate/20170815080839_rename_vat_reverse_charge_column_on_tax_rates.rb +5 -0
  236. data/db/migrate/20170815081018_add_business_to_spina_shop_tax_rates.rb +5 -0
  237. data/db/migrate/20170817075706_add_archived_to_spina_shop_products.rb +5 -0
  238. data/db/migrate/20170824175231_add_metadata_to_photos.rb +7 -0
  239. data/db/migrate/20170829085402_add_business_to_spina_shop_sales_category_codes.rb +5 -0
  240. data/db/migrate/20170911121034_add_trend_to_spina_shop_products.rb +5 -0
  241. data/db/migrate/20171106122225_add_editable_fields_to_spina_shop_product_category_properties.rb +6 -0
  242. data/db/migrate/20171106122537_create_property_options.rb +19 -0
  243. data/db/migrate/20171118110256_add_promotional_price_to_spina_shop_products.rb +6 -0
  244. data/db/migrate/2_create_spina_shop_tax_rates.rb +15 -0
  245. data/db/migrate/3_create_spina_shop_zones.rb +9 -0
  246. data/db/migrate/4_add_tax_rateable_to_spina_shop_tax_rates.rb +9 -0
  247. data/db/migrate/5_add_type_to_spina_shop_zones.rb +5 -0
  248. data/db/migrate/6_add_code_to_spina_shop_zones.rb +5 -0
  249. data/db/migrate/7_create_spina_shop_product_collections.rb +16 -0
  250. data/db/migrate/8_create_spina_shop_sales_category_codes.rb +13 -0
  251. data/db/migrate/9_create_spina_shop_customer_groups.rb +11 -0
  252. data/lib/generators/spina/shop/install_generator.rb +44 -0
  253. data/lib/spina/shop.rb +24 -0
  254. data/lib/spina/shop/admin_helpers.rb +49 -0
  255. data/lib/spina/shop/engine.rb +27 -0
  256. data/lib/spina/shop/errors/empty_order.rb +6 -0
  257. data/lib/spina/shop/errors/order_already_received.rb +6 -0
  258. data/lib/spina/shop/railtie.rb +31 -0
  259. data/lib/spina/shop/simple_linear_regression.rb +36 -0
  260. data/lib/spina/shop/version.rb +5 -0
  261. data/lib/spina/shop/view_helpers.rb +11 -0
  262. data/lib/tasks/spina/shop.rake +32 -0
  263. metadata +627 -0
@@ -0,0 +1,92 @@
1
+ Spina::Engine.routes.draw do
2
+ # Admin routes
3
+ namespace :shop, path: '' do
4
+ namespace :admin, path: Spina.config.backend_path do
5
+ scope '/shop' do
6
+ # Orders
7
+ resources :orders do
8
+ resources :order_items, only: [:new, :create, :destroy]
9
+ member do
10
+ post :cancel
11
+ post :pay
12
+ post :receive
13
+ post :order_picked_up
14
+ post :delivered
15
+ end
16
+ collection do
17
+ get :to_process
18
+ get :failed
19
+ put :transition
20
+ end
21
+ scope module: :orders do
22
+ resource :packing_slip, only: [:show, :create]
23
+ resource :shipping_label, only: [:show, :create]
24
+ end
25
+ end
26
+
27
+ # Settings
28
+ namespace :settings do
29
+ resources :tax_groups
30
+ resources :sales_categories
31
+ resources :product_categories do
32
+ resources :product_category_properties do
33
+ member do
34
+ get :edit_options
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ # Invoices
41
+ resources :invoices, only: [:show]
42
+
43
+ # Products
44
+ resources :products do
45
+ collection do
46
+ get :archived
47
+ end
48
+ member do
49
+ post :archive
50
+ post :unarchive
51
+ end
52
+ get :new_by_category, on: :collection
53
+ scope module: :products do
54
+ resources :stock_level_adjustments
55
+ end
56
+ end
57
+ scope module: :products do
58
+ resource :stock_forecast
59
+ resources :product_bundles
60
+ end
61
+
62
+ # Product reviews
63
+ resources :product_reviews do
64
+ collection do
65
+ delete :delete_multiple
66
+ end
67
+ end
68
+
69
+ # Customers
70
+ resources :customers do
71
+ member do
72
+ get :validate_vat_id
73
+ end
74
+ resource :customer_account
75
+ end
76
+
77
+ # Discounts
78
+ resources :discounts
79
+
80
+ # Reports
81
+ resources :reports
82
+
83
+ # Gift Cards
84
+ resources :gift_cards do
85
+ collection do
86
+ get :unused
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,252 @@
1
+ AD AND Andorra EU .ad EUR
2
+ AE ARE United Arab Emirates AS .ae AED
3
+ AF AFG Afghanistan AS .af AFN
4
+ AG ATG Antigua and Barbuda NA .ag XCD
5
+ AI AIA Anguilla NA .ai XCD
6
+ AL ALB Albania EU .al ALL
7
+ AM ARM Armenia AS .am AMD
8
+ AO AGO Angola AF .ao AOA
9
+ AQ ATA Antarctica AN .aq
10
+ AR ARG Argentina SA .ar ARS
11
+ AS ASM American Samoa OC .as USD
12
+ AT AUT Austria EU .at EUR
13
+ AU AUS Australia OC .au AUD
14
+ AW ABW Aruba NA .aw AWG
15
+ AX ALA Aland Islands EU .ax EUR
16
+ AZ AZE Azerbaijan AS .az AZN
17
+ BA BIH Bosnia and Herzegovina EU .ba BAM
18
+ BB BRB Barbados NA .bb BBD
19
+ BD BGD Bangladesh AS .bd BDT
20
+ BE BEL Belgium EU .be EUR
21
+ BF BFA Burkina Faso AF .bf XOF
22
+ BG BGR Bulgaria EU .bg BGN
23
+ BH BHR Bahrain AS .bh BHD
24
+ BI BDI Burundi AF .bi BIF
25
+ BJ BEN Benin AF .bj XOF
26
+ BL BLM Saint Barthelemy NA .gp EUR
27
+ BM BMU Bermuda NA .bm BMD
28
+ BN BRN Brunei AS .bn BND
29
+ BO BOL Bolivia SA .bo BOB
30
+ BQ BES Bonaire, Saint Eustatius and Saba NA .bq USD
31
+ BR BRA Brazil SA .br BRL
32
+ BS BHS Bahamas NA .bs BSD
33
+ BT BTN Bhutan AS .bt BTN
34
+ BV BVT Bouvet Island AN .bv NOK
35
+ BW BWA Botswana AF .bw BWP
36
+ BY BLR Belarus EU .by BYR
37
+ BZ BLZ Belize NA .bz BZD
38
+ CA CAN Canada NA .ca CAD
39
+ CC CCK Cocos Islands AS .cc AUD
40
+ CD COD Democratic Republic of the Congo AF .cd CDF
41
+ CF CAF Central African Republic AF .cf XAF
42
+ CG COG Republic of the Congo AF .cg XAF
43
+ CH CHE Switzerland EU .ch CHF
44
+ CI CIV Ivory Coast AF .ci XOF
45
+ CK COK Cook Islands OC .ck NZD
46
+ CL CHL Chile SA .cl CLP
47
+ CM CMR Cameroon AF .cm XAF
48
+ CN CHN China AS .cn CNY
49
+ CO COL Colombia SA .co COP
50
+ CR CRI Costa Rica NA .cr CRC
51
+ CU CUB Cuba NA .cu CUP
52
+ CV CPV Cape Verde AF .cv CVE
53
+ CW CUW Curacao NA .cw ANG
54
+ CX CXR Christmas Island AS .cx AUD
55
+ CY CYP Cyprus EU .cy EUR
56
+ CZ CZE Czech Republic EU .cz CZK
57
+ DE DEU Germany EU .de EUR
58
+ DJ DJI Djibouti AF .dj DJF
59
+ DK DNK Denmark EU .dk DKK
60
+ DM DMA Dominica NA .dm XCD
61
+ DO DOM Dominican Republic NA .do DOP
62
+ DZ DZA Algeria AF .dz DZD
63
+ EC ECU Ecuador SA .ec USD
64
+ EE EST Estonia EU .ee EUR
65
+ EG EGY Egypt AF .eg EGP
66
+ EH ESH Western Sahara AF .eh MAD
67
+ ER ERI Eritrea AF .er ERN
68
+ ES ESP Spain EU .es EUR
69
+ ET ETH Ethiopia AF .et ETB
70
+ FI FIN Finland EU .fi EUR
71
+ FJ FJI Fiji OC .fj FJD
72
+ FK FLK Falkland Islands SA .fk FKP
73
+ FM FSM Micronesia OC .fm USD
74
+ FO FRO Faroe Islands EU .fo DKK
75
+ FR FRA France EU .fr EUR
76
+ GA GAB Gabon AF .ga XAF
77
+ GB GBR United Kingdom EU .uk GBP
78
+ GD GRD Grenada NA .gd XCD
79
+ GE GEO Georgia AS .ge GEL
80
+ GF GUF French Guiana SA .gf EUR
81
+ GG GGY Guernsey EU .gg GBP
82
+ GH GHA Ghana AF .gh GHS
83
+ GI GIB Gibraltar EU .gi GIP
84
+ GL GRL Greenland NA .gl DKK
85
+ GM GMB Gambia AF .gm GMD
86
+ GN GIN Guinea AF .gn GNF
87
+ GP GLP Guadeloupe NA .gp EUR
88
+ GQ GNQ Equatorial Guinea AF .gq XAF
89
+ GR GRC Greece EU .gr EUR
90
+ GS SGS South Georgia and the South Sandwich Islands AN .gs GBP
91
+ GT GTM Guatemala NA .gt GTQ
92
+ GU GUM Guam OC .gu USD
93
+ GW GNB Guinea-Bissau AF .gw XOF
94
+ GY GUY Guyana SA .gy GYD
95
+ HK HKG Hong Kong AS .hk HKD
96
+ HM HMD Heard Island and McDonald Islands AN .hm AUD
97
+ HN HND Honduras NA .hn HNL
98
+ HR HRV Croatia EU .hr HRK
99
+ HT HTI Haiti NA .ht HTG
100
+ HU HUN Hungary EU .hu HUF
101
+ ID IDN Indonesia AS .id IDR
102
+ IE IRL Ireland EU .ie EUR
103
+ IL ISR Israel AS .il ILS
104
+ IM IMN Isle of Man EU .im GBP
105
+ IN IND India AS .in INR
106
+ IO IOT British Indian Ocean Territory AS .io USD
107
+ IQ IRQ Iraq AS .iq IQD
108
+ IR IRN Iran AS .ir IRR
109
+ IS ISL Iceland EU .is ISK
110
+ IT ITA Italy EU .it EUR
111
+ JE JEY Jersey EU .je GBP
112
+ JM JAM Jamaica NA .jm JMD
113
+ JO JOR Jordan AS .jo JOD
114
+ JP JPN Japan AS .jp JPY
115
+ KE KEN Kenya AF .ke KES
116
+ KG KGZ Kyrgyzstan AS .kg KGS
117
+ KH KHM Cambodia AS .kh KHR
118
+ KI KIR Kiribati OC .ki AUD
119
+ KM COM Comoros AF .km KMF
120
+ KN KNA Saint Kitts and Nevis NA .kn XCD
121
+ KP PRK North Korea AS .kp KPW
122
+ KR KOR South Korea AS .kr KRW
123
+ XK XKX Kosovo EU EUR
124
+ KW KWT Kuwait AS .kw KWD
125
+ KY CYM Cayman Islands NA .ky KYD
126
+ KZ KAZ Kazakhstan AS .kz KZT
127
+ LA LAO Laos AS .la LAK
128
+ LB LBN Lebanon AS .lb LBP
129
+ LC LCA Saint Lucia NA .lc XCD
130
+ LI LIE Liechtenstein EU .li CHF
131
+ LK LKA Sri Lanka AS .lk LKR
132
+ LR LBR Liberia AF .lr LRD
133
+ LS LSO Lesotho AF .ls LSL
134
+ LT LTU Lithuania EU .lt LTL
135
+ LU LUX Luxembourg EU .lu EUR
136
+ LV LVA Latvia EU .lv LVL
137
+ LY LBY Libya AF .ly LYD
138
+ MA MAR Morocco AF .ma MAD
139
+ MC MCO Monaco EU .mc EUR
140
+ MD MDA Moldova EU .md MDL
141
+ ME MNE Montenegro EU .me EUR
142
+ MF MAF Saint Martin NA .gp EUR
143
+ MG MDG Madagascar AF .mg MGA
144
+ MH MHL Marshall Islands OC .mh USD
145
+ MK MKD Macedonia EU .mk MKD
146
+ ML MLI Mali AF .ml XOF
147
+ MM MMR Myanmar AS .mm MMK
148
+ MN MNG Mongolia AS .mn MNT
149
+ MO MAC Macao AS .mo MOP
150
+ MP MNP Northern Mariana Islands OC .mp USD
151
+ MQ MTQ Martinique NA .mq EUR
152
+ MR MRT Mauritania AF .mr MRO
153
+ MS MSR Montserrat NA .ms XCD
154
+ MT MLT Malta EU .mt EUR
155
+ MU MUS Mauritius AF .mu MUR
156
+ MV MDV Maldives AS .mv MVR
157
+ MW MWI Malawi AF .mw MWK
158
+ MX MEX Mexico NA .mx MXN
159
+ MY MYS Malaysia AS .my MYR
160
+ MZ MOZ Mozambique AF .mz MZN
161
+ NA NAM Namibia AF .na NAD
162
+ NC NCL New Caledonia OC .nc XPF
163
+ NE NER Niger AF .ne XOF
164
+ NF NFK Norfolk Island OC .nf AUD
165
+ NG NGA Nigeria AF .ng NGN
166
+ NI NIC Nicaragua NA .ni NIO
167
+ NL NLD Netherlands EU .nl EUR
168
+ NO NOR Norway EU .no NOK
169
+ NP NPL Nepal AS .np NPR
170
+ NR NRU Nauru OC .nr AUD
171
+ NU NIU Niue OC .nu NZD
172
+ NZ NZL New Zealand OC .nz NZD
173
+ OM OMN Oman AS .om OMR
174
+ PA PAN Panama NA .pa PAB
175
+ PE PER Peru SA .pe PEN
176
+ PF PYF French Polynesia OC .pf XPF
177
+ PG PNG Papua New Guinea OC .pg PGK
178
+ PH PHL Philippines AS .ph PHP
179
+ PK PAK Pakistan AS .pk PKR
180
+ PL POL Poland EU .pl PLN
181
+ PM SPM Saint Pierre and Miquelon NA .pm EUR
182
+ PN PCN Pitcairn OC .pn NZD
183
+ PR PRI Puerto Rico NA .pr USD
184
+ PS PSE Palestinian Territory AS .ps ILS
185
+ PT PRT Portugal EU .pt EUR
186
+ PW PLW Palau OC .pw USD
187
+ PY PRY Paraguay SA .py PYG
188
+ QA QAT Qatar AS .qa QAR
189
+ RE REU Reunion AF .re EUR
190
+ RO ROU Romania EU .ro RON
191
+ RS SRB Serbia EU .rs RSD
192
+ RU RUS Russia EU .ru RUB
193
+ RW RWA Rwanda AF .rw RWF
194
+ SA SAU Saudi Arabia AS .sa SAR
195
+ SB SLB Solomon Islands OC .sb SBD
196
+ SC SYC Seychelles AF .sc SCR
197
+ SD SDN Sudan AF .sd SDG
198
+ SS SSD South Sudan AF SSP
199
+ SE SWE Sweden EU .se SEK
200
+ SG SGP Singapore AS .sg SGD
201
+ SH SHN Saint Helena AF .sh SHP
202
+ SI SVN Slovenia EU .si EUR
203
+ SJ SJM Svalbard and Jan Mayen EU .sj NOK
204
+ SK SVK Slovakia EU .sk EUR
205
+ SL SLE Sierra Leone AF .sl SLL
206
+ SM SMR San Marino EU .sm EUR
207
+ SN SEN Senegal AF .sn XOF
208
+ SO SOM Somalia AF .so SOS
209
+ SR SUR Suriname SA .sr SRD
210
+ ST STP Sao Tome and Principe AF .st STD
211
+ SV SLV El Salvador NA .sv USD
212
+ SX SXM Sint Maarten NA .sx ANG
213
+ SY SYR Syria AS .sy SYP
214
+ SZ SWZ Swaziland AF .sz SZL
215
+ TC TCA Turks and Caicos Islands NA .tc USD
216
+ TD TCD Chad AF .td XAF
217
+ TF ATF French Southern Territories AN .tf EUR
218
+ TG TGO Togo AF .tg XOF
219
+ TH THA Thailand AS .th THB
220
+ TJ TJK Tajikistan AS .tj TJS
221
+ TK TKL Tokelau OC .tk NZD
222
+ TL TLS East Timor OC .tl USD
223
+ TM TKM Turkmenistan AS .tm TMT
224
+ TN TUN Tunisia AF .tn TND
225
+ TO TON Tonga OC .to TOP
226
+ TR TUR Turkey AS .tr TRY
227
+ TT TTO Trinidad and Tobago NA .tt TTD
228
+ TV TUV Tuvalu OC .tv AUD
229
+ TW TWN Taiwan AS .tw TWD
230
+ TZ TZA Tanzania AF .tz TZS
231
+ UA UKR Ukraine EU .ua UAH
232
+ UG UGA Uganda AF .ug UGX
233
+ UM UMI United States Minor Outlying Islands OC .um USD
234
+ US USA United States NA .us USD
235
+ UY URY Uruguay SA .uy UYU
236
+ UZ UZB Uzbekistan AS .uz UZS
237
+ VA VAT Vatican EU .va EUR
238
+ VC VCT Saint Vincent and the Grenadines NA .vc XCD
239
+ VE VEN Venezuela SA .ve VEF
240
+ VG VGB British Virgin Islands NA .vg USD
241
+ VI VIR U.S. Virgin Islands NA .vi USD
242
+ VN VNM Vietnam AS .vn VND
243
+ VU VUT Vanuatu OC .vu VUV
244
+ WF WLF Wallis and Futuna OC .wf XPF
245
+ WS WSM Samoa OC .ws WST
246
+ YE YEM Yemen AS .ye YER
247
+ YT MYT Mayotte AF .yt EUR
248
+ ZA ZAF South Africa AF .za ZAR
249
+ ZM ZMB Zambia AF .zm ZMK
250
+ ZW ZWE Zimbabwe AF .zw ZWL
251
+ CS SCG Serbia and Montenegro EU .cs RSD
252
+ AN ANT Netherlands Antilles NA .an ANG
@@ -0,0 +1,23 @@
1
+ class CreateSpinaShopProductsWithoutItems < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :spina_shop_products, :sku, :string
4
+ add_column :spina_shop_products, :location, :string, default: "", null: false
5
+ add_column :spina_shop_products, :tax_group_id, :integer
6
+ add_column :spina_shop_products, :weight, :decimal, precision: 8, scale: 3
7
+ add_column :spina_shop_products, :price, :decimal, precision: 8, scale: 2
8
+ add_column :spina_shop_products, :cost_price, :decimal, precision: 8, scale: 2
9
+ add_column :spina_shop_products, :ean, :string
10
+ add_column :spina_shop_products, :sales_category_id, :integer
11
+ add_column :spina_shop_products, :must_be_of_age_to_buy, :boolean, default: false
12
+ add_column :spina_shop_products, :can_expire, :boolean, default: false
13
+ add_column :spina_shop_products, :expiration_date, :date
14
+ add_column :spina_shop_products, :stock_level, :integer, default: 0, null: false
15
+ add_column :spina_shop_products, :supplier_reference, :string
16
+
17
+ add_column :spina_shop_stock_level_adjustments, :product_id, :integer
18
+
19
+ add_index :spina_shop_products, :tax_group_id
20
+ add_index :spina_shop_products, :sales_category_id
21
+ add_index :spina_shop_stock_level_adjustments, :product_id
22
+ end
23
+ end
@@ -0,0 +1,518 @@
1
+ class CreateSpinaShopTables < ActiveRecord::Migration[5.0]
2
+ def change
3
+ enable_extension "plpgsql"
4
+ enable_extension "pg_trgm"
5
+ enable_extension "btree_gin"
6
+ enable_extension "unaccent"
7
+
8
+ create_table "spina_shop_addresses", force: :cascade do |t|
9
+ t.string "address_type"
10
+ t.integer "customer_id"
11
+ t.string "postal_code"
12
+ t.string "city"
13
+ t.integer "country_id"
14
+ t.datetime "created_at", null: false
15
+ t.datetime "updated_at", null: false
16
+ t.string "house_number"
17
+ t.string "house_number_addition"
18
+ t.string "first_name"
19
+ t.string "last_name"
20
+ t.string "street1"
21
+ t.string "name"
22
+ t.string "company"
23
+ t.string "street2"
24
+ t.index ["country_id"], name: "idx_shop_addresses_on_country_id", using: :btree
25
+ t.index ["customer_id"], name: "idx_shop_addresses_on_customer_id", using: :btree
26
+ end
27
+
28
+ create_table "spina_shop_bundled_product_items", force: :cascade do |t|
29
+ t.integer "product_item_id"
30
+ t.integer "product_bundle_id"
31
+ t.integer "quantity", default: 0, null: false
32
+ t.datetime "created_at", null: false
33
+ t.datetime "updated_at", null: false
34
+ t.index ["product_bundle_id"], name: "idx_shop_bundled_product_items_on_product_bundle_id", using: :btree
35
+ t.index ["product_item_id"], name: "idx_shop_bundled_product_items_on_product_item_id", using: :btree
36
+ end
37
+
38
+ create_table "spina_shop_countries", force: :cascade do |t|
39
+ t.string "name"
40
+ t.string "code2"
41
+ t.boolean "eu_member", default: false, null: false
42
+ t.datetime "created_at"
43
+ t.datetime "updated_at"
44
+ end
45
+
46
+ create_table "spina_shop_customer_accounts", force: :cascade do |t|
47
+ t.integer "customer_id", null: false
48
+ t.string "email", null: false
49
+ t.string "password_digest", null: false
50
+ t.datetime "created_at", null: false
51
+ t.datetime "updated_at", null: false
52
+ t.string "password_reset_token"
53
+ t.datetime "password_reset_sent_at"
54
+ t.index ["customer_id"], name: "idx_shop_customer_accounts_on_customer_id", using: :btree
55
+ t.index ["email"], name: "idx_shop_customer_accounts_on_email", unique: true, using: :btree
56
+ t.index ["password_reset_token"], name: "idx_shop_customer_accounts_on_password_reset_token", unique: true, using: :btree
57
+ end
58
+
59
+ create_table "spina_shop_customers", force: :cascade do |t|
60
+ t.string "first_name"
61
+ t.string "last_name"
62
+ t.string "company"
63
+ t.string "email"
64
+ t.string "phone"
65
+ t.datetime "created_at"
66
+ t.datetime "updated_at"
67
+ t.string "full_name"
68
+ t.integer "number"
69
+ t.date "date_of_birth"
70
+ t.integer "country_id"
71
+ t.index ["country_id"], name: "idx_shop_customers_on_country_id", using: :btree
72
+ end
73
+
74
+ create_table "spina_shop_delivery_options", force: :cascade do |t|
75
+ t.string "name"
76
+ t.string "carrier"
77
+ t.decimal "price", precision: 8, scale: 2, default: "0.0", null: false
78
+ t.integer "tax_group_id"
79
+ t.integer "sales_category_id"
80
+ t.datetime "created_at", null: false
81
+ t.datetime "updated_at", null: false
82
+ t.boolean "requires_shipping", default: false, null: false
83
+ t.string "description"
84
+ t.index ["sales_category_id"], name: "idx_shop_delivery_options_on_sales_category_id", using: :btree
85
+ t.index ["tax_group_id"], name: "idx_shop_delivery_options_on_tax_group_id", using: :btree
86
+ end
87
+
88
+ create_table "spina_shop_discount_actions", force: :cascade do |t|
89
+ t.integer "discount_id"
90
+ t.string "type"
91
+ t.text "preferences"
92
+ t.datetime "created_at", null: false
93
+ t.datetime "updated_at", null: false
94
+ t.index ["discount_id"], name: "idx_shop_discount_actions_on_discount_id", using: :btree
95
+ end
96
+
97
+ create_table "spina_shop_discount_rules", force: :cascade do |t|
98
+ t.integer "discount_id"
99
+ t.string "type"
100
+ t.text "preferences"
101
+ t.datetime "created_at", null: false
102
+ t.datetime "updated_at", null: false
103
+ t.index ["discount_id"], name: "idx_shop_discount_rules_on_discount_id", using: :btree
104
+ end
105
+
106
+ create_table "spina_shop_discounts", force: :cascade do |t|
107
+ t.string "code", null: false
108
+ t.date "starts_at", null: false
109
+ t.date "expires_at"
110
+ t.integer "usage_limit", default: 0, null: false
111
+ t.integer "discount_value"
112
+ t.string "discount_type", default: "percentage"
113
+ t.datetime "created_at", null: false
114
+ t.datetime "updated_at", null: false
115
+ t.string "type"
116
+ t.text "preferences"
117
+ t.text "description"
118
+ t.index ["code"], name: "idx_shop_discounts_on_code", unique: true, using: :btree
119
+ end
120
+
121
+ create_table "spina_shop_discounts_orders", force: :cascade do |t|
122
+ t.integer "order_id"
123
+ t.integer "discount_id"
124
+ t.datetime "created_at", null: false
125
+ t.datetime "updated_at", null: false
126
+ t.index ["discount_id"], name: "idx_shop_discounts_orders_on_discount_id", using: :btree
127
+ t.index ["order_id"], name: "idx_shop_discounts_orders_on_order_id", using: :btree
128
+ end
129
+
130
+ create_table "spina_shop_favorites", force: :cascade do |t|
131
+ t.integer "product_id"
132
+ t.integer "customer_id"
133
+ t.datetime "created_at", null: false
134
+ t.datetime "updated_at", null: false
135
+ end
136
+
137
+ create_table "spina_shop_gift_cards", force: :cascade do |t|
138
+ t.string "code", null: false
139
+ t.date "expires_at", null: false
140
+ t.decimal "value", precision: 8, scale: 2, default: "0.0", null: false
141
+ t.decimal "remaining_balance", precision: 8, scale: 2, default: "0.0", null: false
142
+ t.datetime "created_at", null: false
143
+ t.datetime "updated_at", null: false
144
+ t.index ["code"], name: "idx_shop_gift_cards_on_code", unique: true, using: :btree
145
+ end
146
+
147
+ create_table "spina_shop_gift_cards_orders", force: :cascade do |t|
148
+ t.integer "order_id"
149
+ t.integer "gift_card_id"
150
+ t.datetime "created_at", null: false
151
+ t.datetime "updated_at", null: false
152
+ t.index ["gift_card_id"], name: "idx_shop_gift_cards_orders_on_gift_card_id", using: :btree
153
+ t.index ["order_id", "gift_card_id"], name: "idx_shop_gift_cards_orders_on_order_id_and_gift_card_id", unique: true, using: :btree
154
+ t.index ["order_id"], name: "idx_shop_gift_cards_orders_on_order_id", using: :btree
155
+ end
156
+
157
+ create_table "spina_shop_in_stock_reminders", force: :cascade do |t|
158
+ t.string "email"
159
+ t.integer "orderable_id"
160
+ t.string "orderable_type"
161
+ t.datetime "created_at", null: false
162
+ t.datetime "updated_at", null: false
163
+ t.index ["orderable_id"], name: "idx_shop_in_stock_reminders_on_orderable_id", using: :btree
164
+ end
165
+
166
+ create_table "spina_shop_invoice_lines", force: :cascade do |t|
167
+ t.integer "invoice_id"
168
+ t.text "description", null: false
169
+ t.integer "quantity", default: 1, null: false
170
+ t.decimal "unit_price", precision: 8, scale: 2, default: "0.0", null: false
171
+ t.decimal "tax_rate", precision: 8, scale: 2, default: "0.0", null: false
172
+ t.datetime "created_at", null: false
173
+ t.datetime "updated_at", null: false
174
+ t.jsonb "metadata", default: "{}", null: false
175
+ t.decimal "discount_amount", precision: 8, scale: 2, default: "0.0", null: false
176
+ t.index ["invoice_id"], name: "idx_shop_invoice_lines_on_invoice_id", using: :btree
177
+ end
178
+
179
+ create_table "spina_shop_invoices", force: :cascade do |t|
180
+ t.integer "order_id", null: false
181
+ t.integer "customer_id", null: false
182
+ t.integer "number", null: false
183
+ t.boolean "prices_include_tax", default: false, null: false
184
+ t.date "date", null: false
185
+ t.integer "country_id", null: false
186
+ t.integer "order_number", null: false
187
+ t.integer "customer_number", null: false
188
+ t.string "company_name"
189
+ t.string "customer_name", null: false
190
+ t.string "address_1", null: false
191
+ t.string "address_2"
192
+ t.string "address_3"
193
+ t.string "address_4"
194
+ t.datetime "created_at", null: false
195
+ t.datetime "updated_at", null: false
196
+ t.string "postal_code"
197
+ t.string "city"
198
+ t.text "identity_details"
199
+ t.string "identity_name"
200
+ t.string "invoice_number"
201
+ t.jsonb "export_data", default: "{}", null: false
202
+ t.boolean "exported", default: false, null: false
203
+ t.string "country_name"
204
+ t.index ["country_id"], name: "idx_shop_invoices_on_country_id", using: :btree
205
+ t.index ["customer_id"], name: "idx_shop_invoices_on_customer_id", using: :btree
206
+ t.index ["invoice_number"], name: "idx_shop_invoices_on_invoice_number", unique: true, using: :btree
207
+ t.index ["number"], name: "idx_shop_invoices_on_number", unique: true, using: :btree
208
+ t.index ["order_id"], name: "idx_shop_invoices_on_order_id", using: :btree
209
+ end
210
+
211
+ create_table "spina_shop_number_sequences", force: :cascade do |t|
212
+ t.string "name", null: false
213
+ t.integer "next_number", default: 1, null: false
214
+ t.datetime "created_at", null: false
215
+ t.datetime "updated_at", null: false
216
+ end
217
+
218
+ create_table "spina_shop_order_items", force: :cascade do |t|
219
+ t.integer "order_id"
220
+ t.integer "quantity", default: 0, null: false
221
+ t.decimal "tax_rate", precision: 8, scale: 2
222
+ t.datetime "created_at"
223
+ t.datetime "updated_at"
224
+ t.decimal "unit_price", precision: 8, scale: 2
225
+ t.decimal "unit_cost_price", precision: 8, scale: 2
226
+ t.decimal "weight", precision: 8, scale: 3
227
+ t.string "orderable_type"
228
+ t.integer "orderable_id"
229
+ t.jsonb "metadata", default: "{}", null: false
230
+ t.decimal "discount_amount", precision: 8, scale: 2
231
+ t.index ["order_id"], name: "idx_shop_order_items_on_order_id", using: :btree
232
+ t.index ["orderable_id"], name: "idx_shop_order_items_on_orderable_id", using: :btree
233
+ end
234
+
235
+ create_table "spina_shop_order_transitions", force: :cascade do |t|
236
+ t.string "to_state", null: false
237
+ t.json "metadata", default: {}
238
+ t.integer "sort_key", null: false
239
+ t.integer "order_id", null: false
240
+ t.boolean "most_recent", null: false
241
+ t.datetime "created_at", null: false
242
+ t.datetime "updated_at", null: false
243
+ t.index ["order_id", "most_recent"], name: "index_order_transitions_parent_most_recent", unique: true, where: "most_recent", using: :btree
244
+ t.index ["order_id", "sort_key"], name: "index_order_transitions_parent_sort", unique: true, using: :btree
245
+ end
246
+
247
+ create_table "spina_shop_orders", force: :cascade do |t|
248
+ t.string "first_name"
249
+ t.string "last_name"
250
+ t.string "company"
251
+ t.string "email"
252
+ t.string "phone"
253
+ t.string "status"
254
+ t.datetime "received_at"
255
+ t.datetime "shipped_at"
256
+ t.integer "customer_id"
257
+ t.datetime "created_at"
258
+ t.datetime "updated_at"
259
+ t.integer "billing_country_id"
260
+ t.boolean "prices_include_tax", default: false, null: false
261
+ t.integer "order_number"
262
+ t.datetime "paid_at"
263
+ t.datetime "delivered_at"
264
+ t.datetime "order_picked_at"
265
+ t.string "delivery_postal_code"
266
+ t.string "delivery_city"
267
+ t.integer "delivery_country_id"
268
+ t.boolean "separate_delivery_address", default: false
269
+ t.string "billing_postal_code"
270
+ t.string "billing_city"
271
+ t.string "payment_id"
272
+ t.datetime "failed_at"
273
+ t.string "payment_url"
274
+ t.string "payment_method"
275
+ t.integer "billing_house_number"
276
+ t.string "billing_house_number_addition"
277
+ t.string "ip_address"
278
+ t.integer "user_id"
279
+ t.boolean "pos", default: false, null: false
280
+ t.string "payment_issuer"
281
+ t.integer "delivery_house_number"
282
+ t.string "delivery_house_number_addition"
283
+ t.date "date_of_birth"
284
+ t.integer "delivery_option_id"
285
+ t.string "delivery_tracking_ids", array: true
286
+ t.datetime "picked_up_at"
287
+ t.decimal "delivery_price", precision: 8, scale: 2
288
+ t.decimal "delivery_tax_rate", precision: 8, scale: 2
289
+ t.datetime "cancelled_at"
290
+ t.datetime "confirming_at"
291
+ t.integer "duplicate_id"
292
+ t.string "billing_street1"
293
+ t.string "delivery_street1"
294
+ t.string "delivery_name"
295
+ t.string "billing_street2"
296
+ t.string "delivery_street2"
297
+ t.jsonb "delivery_metadata", default: "{}", null: false
298
+ t.text "note"
299
+ t.string "token"
300
+ t.index ["billing_country_id"], name: "idx_shop_orders_on_billing_country_id", using: :btree
301
+ t.index ["order_number"], name: "idx_shop_orders_on_order_number", unique: true, using: :btree
302
+ end
303
+
304
+ create_table "spina_shop_product_bundle_parts", force: :cascade do |t|
305
+ t.integer "product_bundle_id"
306
+ t.datetime "created_at", null: false
307
+ t.datetime "updated_at", null: false
308
+ end
309
+
310
+ create_table "spina_shop_product_bundles", force: :cascade do |t|
311
+ t.string "name"
312
+ t.decimal "price", precision: 8, scale: 2
313
+ t.boolean "tax_included_in_price", default: true, null: false
314
+ t.integer "tax_group_id"
315
+ t.datetime "created_at", null: false
316
+ t.datetime "updated_at", null: false
317
+ t.text "description"
318
+ t.integer "sales_category_id"
319
+ t.boolean "must_be_of_age_to_buy", default: false
320
+ t.index ["sales_category_id"], name: "idx_shop_product_bundles_on_sales_category_id", using: :btree
321
+ t.index ["tax_group_id"], name: "idx_shop_product_bundles_on_tax_group_id", using: :btree
322
+ end
323
+
324
+ create_table "spina_shop_product_categories", force: :cascade do |t|
325
+ t.string "name"
326
+ t.datetime "created_at"
327
+ t.datetime "updated_at"
328
+ t.text "review_categories"
329
+ end
330
+
331
+ create_table "spina_shop_product_category_properties", force: :cascade do |t|
332
+ t.string "name"
333
+ t.string "property_type"
334
+ t.boolean "required", default: false, null: false
335
+ t.integer "product_category_id"
336
+ t.datetime "created_at"
337
+ t.datetime "updated_at"
338
+ t.string "field_type"
339
+ t.decimal "minimum"
340
+ t.decimal "maximum"
341
+ t.integer "max_characters"
342
+ t.boolean "multiple", default: false, null: false
343
+ t.string "prepend"
344
+ t.string "append"
345
+ t.text "options"
346
+ t.string "label"
347
+ t.index ["product_category_id"], name: "idx_shop_product_category_properties_on_product_category_id", using: :btree
348
+ end
349
+
350
+ create_table "spina_shop_product_images", force: :cascade do |t|
351
+ t.integer "product_id"
352
+ t.string "file_id"
353
+ t.datetime "created_at"
354
+ t.datetime "updated_at"
355
+ t.string "alt_description"
356
+ t.integer "position"
357
+ t.integer "product_item_id"
358
+ t.integer "product_bundle_id"
359
+ t.index ["product_bundle_id"], name: "idx_shop_product_images_on_product_bundle_id", using: :btree
360
+ t.index ["product_id"], name: "idx_shop_product_images_on_product_id", using: :btree
361
+ t.index ["product_item_id"], name: "idx_shop_product_images_on_product_item_id", using: :btree
362
+ end
363
+
364
+ create_table "spina_shop_product_items", force: :cascade do |t|
365
+ t.string "sku"
366
+ t.string "location"
367
+ t.integer "product_id"
368
+ t.datetime "created_at"
369
+ t.datetime "updated_at"
370
+ t.integer "tax_group_id"
371
+ t.boolean "tax_included_in_price", default: true, null: false
372
+ t.jsonb "properties", default: "{}", null: false
373
+ t.decimal "weight", precision: 8, scale: 3
374
+ t.decimal "price", precision: 8, scale: 2
375
+ t.decimal "cost_price", precision: 8, scale: 2
376
+ t.string "ean"
377
+ t.integer "sales_category_id"
378
+ t.boolean "must_be_of_age_to_buy", default: false
379
+ t.string "name"
380
+ t.boolean "can_expire", default: false, null: false
381
+ t.date "expiration_date"
382
+ t.integer "stock_level", default: 0, null: false
383
+ t.string "supplier_reference"
384
+ t.boolean "active", default: false, null: false
385
+ t.index ["product_id"], name: "idx_shop_product_items_on_product_id", using: :btree
386
+ t.index ["sales_category_id"], name: "idx_shop_product_items_on_sales_category_id", using: :btree
387
+ t.index ["tax_group_id"], name: "idx_shop_product_items_on_tax_group_id", using: :btree
388
+ end
389
+
390
+ create_table "spina_shop_product_parts", force: :cascade do |t|
391
+ t.integer "product_id"
392
+ t.datetime "created_at", null: false
393
+ t.datetime "updated_at", null: false
394
+ end
395
+
396
+ create_table "spina_shop_product_relations", force: :cascade do |t|
397
+ t.integer "product_id"
398
+ t.integer "related_product_id"
399
+ t.index ["product_id"], name: "idx_shop_product_relations_on_product_id", using: :btree
400
+ t.index ["related_product_id"], name: "idx_shop_product_relations_on_related_product_id", using: :btree
401
+ end
402
+
403
+ create_table "spina_shop_product_reviews", force: :cascade do |t|
404
+ t.integer "customer_id"
405
+ t.text "review"
406
+ t.string "author"
407
+ t.datetime "created_at", null: false
408
+ t.datetime "updated_at", null: false
409
+ t.text "review_summary"
410
+ t.string "email"
411
+ t.decimal "score", precision: 3, scale: 1
412
+ t.integer "product_id"
413
+ t.integer "shop_review_id"
414
+ t.index ["customer_id"], name: "idx_shop_product_reviews_on_customer_id", using: :btree
415
+ t.index ["product_id"], name: "idx_shop_product_reviews_on_product_id", using: :btree
416
+ end
417
+
418
+ create_table "spina_shop_product_translations", force: :cascade do |t|
419
+ t.integer "spina_shop_product_id", null: false
420
+ t.string "locale", null: false
421
+ t.datetime "created_at", null: false
422
+ t.datetime "updated_at", null: false
423
+ t.string "name"
424
+ t.text "description"
425
+ t.string "seo_title"
426
+ t.string "seo_description"
427
+ t.string "materialized_path"
428
+ t.index ["locale"], name: "idx_shop_product_translations_on_locale", using: :btree
429
+ t.index ["spina_shop_product_id"], name: "idx_shop_product_translations_on_spina_product_id", using: :btree
430
+ end
431
+
432
+ create_table "spina_shop_products", force: :cascade do |t|
433
+ t.integer "product_category_id"
434
+ t.datetime "created_at"
435
+ t.datetime "updated_at"
436
+ t.jsonb "properties", default: "{}", null: false
437
+ t.string "name"
438
+ t.float "average_review_score"
439
+ t.integer "sales_count"
440
+ t.decimal "lowest_price", precision: 8, scale: 2
441
+ t.string "supplier"
442
+ t.boolean "active", default: false, null: false
443
+ t.index ["name"], name: "idx_shop_products_on_name", using: :gin
444
+ t.index ["product_category_id"], name: "idx_shop_products_on_product_category_id", using: :btree
445
+ end
446
+
447
+ create_table "spina_shop_sales_categories", force: :cascade do |t|
448
+ t.string "name"
449
+ t.jsonb "codes", default: "{}", null: false
450
+ t.datetime "created_at", null: false
451
+ t.datetime "updated_at", null: false
452
+ t.jsonb "metadata", default: "{}", null: false
453
+ end
454
+
455
+ create_table "spina_shop_shop_reviews", force: :cascade do |t|
456
+ t.string "author"
457
+ t.text "review_pros"
458
+ t.text "review_cons"
459
+ t.decimal "score"
460
+ t.decimal "score_communication"
461
+ t.decimal "score_speed"
462
+ t.integer "order_id"
463
+ t.integer "customer_id"
464
+ t.datetime "created_at", null: false
465
+ t.datetime "updated_at", null: false
466
+ t.string "email"
467
+ end
468
+
469
+ create_table "spina_shop_stock_level_adjustments", force: :cascade do |t|
470
+ t.integer "product_item_id"
471
+ t.integer "order_item_id"
472
+ t.integer "adjustment", default: 0, null: false
473
+ t.text "description"
474
+ t.string "actor"
475
+ t.datetime "created_at", null: false
476
+ t.datetime "updated_at", null: false
477
+ t.integer "expiration_month"
478
+ t.integer "expiration_year"
479
+ t.index ["order_item_id"], name: "idx_shop_stock_level_adjustments_on_order_item_id", using: :btree
480
+ t.index ["product_item_id"], name: "idx_shop_stock_level_adjustments_on_product_item_id", using: :btree
481
+ end
482
+
483
+ create_table "spina_shop_tax_groups", force: :cascade do |t|
484
+ t.string "name"
485
+ t.datetime "created_at"
486
+ t.datetime "updated_at"
487
+ t.jsonb "tax_rates", default: "{}", null: false
488
+ t.jsonb "metadata", default: "{}", null: false
489
+ end
490
+
491
+ add_foreign_key "spina_shop_addresses", "spina_shop_countries", column: "country_id"
492
+ add_foreign_key "spina_shop_addresses", "spina_shop_customers", column: "customer_id"
493
+ add_foreign_key "spina_shop_bundled_product_items", "spina_shop_product_bundles", column: "product_bundle_id"
494
+ add_foreign_key "spina_shop_bundled_product_items", "spina_shop_product_items", column: "product_item_id"
495
+ add_foreign_key "spina_shop_customer_accounts", "spina_shop_customers", column: "customer_id"
496
+ add_foreign_key "spina_shop_customers", "spina_shop_countries", column: "country_id"
497
+ add_foreign_key "spina_shop_delivery_options", "spina_shop_sales_categories", column: "sales_category_id"
498
+ add_foreign_key "spina_shop_delivery_options", "spina_shop_tax_groups", column: "tax_group_id"
499
+ add_foreign_key "spina_shop_invoice_lines", "spina_shop_invoices", column: "invoice_id"
500
+ add_foreign_key "spina_shop_invoices", "spina_shop_countries", column: "country_id"
501
+ add_foreign_key "spina_shop_invoices", "spina_shop_customers", column: "customer_id"
502
+ add_foreign_key "spina_shop_invoices", "spina_shop_orders", column: "order_id"
503
+ add_foreign_key "spina_shop_order_items", "spina_shop_orders", column: "order_id"
504
+ add_foreign_key "spina_shop_order_transitions", "spina_shop_orders", column: "order_id"
505
+ add_foreign_key "spina_shop_orders", "spina_shop_countries", column: "billing_country_id"
506
+ add_foreign_key "spina_shop_product_bundles", "spina_shop_sales_categories", column: "sales_category_id"
507
+ add_foreign_key "spina_shop_product_bundles", "spina_shop_tax_groups", column: "tax_group_id"
508
+ add_foreign_key "spina_shop_product_category_properties", "spina_shop_product_categories", column: "product_category_id"
509
+ add_foreign_key "spina_shop_product_items", "spina_shop_products", column: "product_id"
510
+ add_foreign_key "spina_shop_product_items", "spina_shop_sales_categories", column: "sales_category_id"
511
+ add_foreign_key "spina_shop_product_items", "spina_shop_tax_groups", column: "tax_group_id"
512
+ add_foreign_key "spina_shop_product_relations", "spina_shop_products", column: "product_id"
513
+ add_foreign_key "spina_shop_product_relations", "spina_shop_products", column: "related_product_id"
514
+ add_foreign_key "spina_shop_product_translations", "spina_shop_products"
515
+ add_foreign_key "spina_shop_products", "spina_shop_product_categories", column: "product_category_id"
516
+ add_foreign_key "spina_shop_stock_level_adjustments", "spina_shop_product_items", column: "product_item_id"
517
+ end
518
+ end