spree_core 3.6.6 → 3.7.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree.js +60 -0
  3. data/app/finders/spree/countries/find.rb +31 -0
  4. data/app/finders/spree/credit_cards/find.rb +12 -0
  5. data/app/finders/spree/line_items/find_by_variant.rb +13 -0
  6. data/app/finders/spree/orders/find_current.rb +34 -0
  7. data/app/finders/spree/products/find.rb +93 -0
  8. data/app/finders/spree/taxons/find.rb +79 -0
  9. data/app/helpers/spree/base_helper.rb +7 -3
  10. data/app/helpers/spree/products_helper.rb +2 -1
  11. data/app/models/concerns/spree/adjustment_source.rb +11 -6
  12. data/app/models/concerns/spree/user_address.rb +2 -2
  13. data/app/models/concerns/spree/vat_price_calculation.rb +2 -1
  14. data/app/models/spree/ability.rb +2 -2
  15. data/app/models/spree/address.rb +23 -14
  16. data/app/models/spree/adjustable/adjustments_updater.rb +1 -1
  17. data/app/models/spree/adjustable/promotion_accumulator.rb +2 -1
  18. data/app/models/spree/adjustment.rb +18 -3
  19. data/app/models/spree/asset/support/active_storage.rb +1 -1
  20. data/app/models/spree/calculator.rb +1 -4
  21. data/app/models/spree/calculator/flexi_rate.rb +8 -11
  22. data/app/models/spree/calculator/returns/default_refund_amount.rb +3 -1
  23. data/app/models/spree/calculator/shipping/flexi_rate.rb +13 -13
  24. data/app/models/spree/country.rb +4 -0
  25. data/app/models/spree/credit_card.rb +8 -2
  26. data/app/models/spree/customer_return.rb +1 -0
  27. data/app/models/spree/fulfilment_changer.rb +117 -0
  28. data/app/models/spree/gateway.rb +1 -0
  29. data/app/models/spree/gateway/bogus.rb +3 -2
  30. data/app/models/spree/image.rb +13 -0
  31. data/app/models/spree/image/configuration/active_storage.rb +3 -3
  32. data/app/models/spree/inventory_unit.rb +1 -1
  33. data/app/models/spree/line_item.rb +3 -2
  34. data/app/models/spree/order.rb +72 -28
  35. data/app/models/spree/order/checkout.rb +10 -0
  36. data/app/models/spree/order/store_credit.rb +14 -35
  37. data/app/models/spree/order_contents.rb +22 -118
  38. data/app/models/spree/order_inventory.rb +6 -2
  39. data/app/models/spree/order_merger.rb +1 -3
  40. data/app/models/spree/order_promotion.rb +10 -0
  41. data/app/models/spree/order_updater.rb +11 -8
  42. data/app/models/spree/payment.rb +9 -3
  43. data/app/models/spree/payment/processing.rb +4 -4
  44. data/app/models/spree/preferences/store.rb +3 -3
  45. data/app/models/spree/product.rb +32 -0
  46. data/app/models/spree/product/scopes.rb +13 -34
  47. data/app/models/spree/product_property.rb +1 -1
  48. data/app/models/spree/promotion.rb +2 -0
  49. data/app/models/spree/promotion/actions/create_adjustment.rb +6 -1
  50. data/app/models/spree/promotion/actions/create_item_adjustments.rb +10 -2
  51. data/app/models/spree/promotion/actions/create_line_items.rb +3 -2
  52. data/app/models/spree/promotion/actions/free_shipping.rb +1 -0
  53. data/app/models/spree/promotion/rules/item_total.rb +2 -2
  54. data/app/models/spree/promotion_handler/coupon.rb +10 -6
  55. data/app/models/spree/promotion_handler/page.rb +1 -1
  56. data/app/models/spree/promotion_handler/promotion_duplicator.rb +4 -4
  57. data/app/models/spree/refund.rb +1 -1
  58. data/app/models/spree/reimbursement/reimbursement_type_engine.rb +1 -0
  59. data/app/models/spree/reimbursement_tax_calculator.rb +2 -2
  60. data/app/models/spree/return_item.rb +7 -4
  61. data/app/models/spree/return_item/eligibility_validator/default.rb +6 -6
  62. data/app/models/spree/return_item/exchange_variant_eligibility/same_product.rb +1 -1
  63. data/app/models/spree/shipment.rb +27 -34
  64. data/app/models/spree/shipping_method.rb +2 -0
  65. data/app/models/spree/shipping_rate.rb +31 -16
  66. data/app/models/spree/stock/adjuster.rb +1 -0
  67. data/app/models/spree/stock/estimator.rb +2 -0
  68. data/app/models/spree/stock/inventory_unit_builder.rb +5 -5
  69. data/app/models/spree/stock/packer.rb +1 -0
  70. data/app/models/spree/stock/quantifier.rb +16 -4
  71. data/app/models/spree/stock_item.rb +1 -0
  72. data/app/models/spree/stock_location.rb +1 -1
  73. data/app/models/spree/stock_movement.rb +1 -0
  74. data/app/models/spree/stock_transfer.rb +1 -1
  75. data/app/models/spree/store_credit.rb +5 -10
  76. data/app/models/spree/tax_rate.rb +3 -0
  77. data/app/models/spree/taxon.rb +2 -2
  78. data/app/models/spree/taxon_image.rb +18 -0
  79. data/app/models/spree/{taxon_icon → taxon_image}/configuration/active_storage.rb +2 -2
  80. data/app/models/spree/{taxon_icon → taxon_image}/configuration/paperclip.rb +1 -1
  81. data/app/models/spree/variant.rb +28 -2
  82. data/app/models/spree/zone.rb +5 -5
  83. data/app/paginators/spree/shared/paginate.rb +19 -0
  84. data/app/services/spree/cart/add_item.rb +43 -0
  85. data/app/services/spree/cart/create.rb +21 -0
  86. data/app/services/spree/cart/recalculate.rb +32 -0
  87. data/app/services/spree/cart/remove_item.rb +37 -0
  88. data/app/services/spree/cart/remove_line_item.rb +16 -0
  89. data/app/services/spree/cart/set_quantity.rb +22 -0
  90. data/app/services/spree/cart/update.rb +37 -0
  91. data/app/services/spree/checkout/add_store_credit.rb +51 -0
  92. data/app/services/spree/checkout/advance.rb +18 -0
  93. data/app/services/spree/checkout/complete.rb +23 -0
  94. data/app/services/spree/checkout/get_shipping_rates.rb +48 -0
  95. data/app/services/spree/checkout/next.rb +13 -0
  96. data/app/services/spree/checkout/remove_store_credit.rb +17 -0
  97. data/app/services/spree/checkout/update.rb +13 -0
  98. data/app/services/spree/compare_line_items.rb +21 -0
  99. data/app/services/spree/generate_token.rb +20 -0
  100. data/app/sorters/spree/products/sort.rb +58 -0
  101. data/config/locales/en.yml +20 -1
  102. data/db/default/spree/countries.rb +1 -1
  103. data/db/default/spree/default_reimbursement_type.rb +1 -1
  104. data/db/default/spree/roles.rb +2 -2
  105. data/db/default/spree/states.rb +2 -1
  106. data/db/default/spree/stores.rb +1 -1
  107. data/db/default/spree/zones.rb +5 -6
  108. data/db/migrate/20120831092320_spree_one_two.rb +36 -36
  109. data/db/migrate/20120831092359_spree_promo_one_two.rb +1 -1
  110. data/db/migrate/20130211190146_create_spree_stock_items.rb +1 -1
  111. data/db/migrate/20130211191120_create_spree_stock_locations.rb +1 -1
  112. data/db/migrate/20130301162924_create_shipping_method_categories.rb +1 -1
  113. data/db/migrate/20130304162240_create_spree_shipping_rates.rb +1 -1
  114. data/db/migrate/20130305143310_create_stock_movements.rb +1 -1
  115. data/db/migrate/20130418125341_create_spree_stock_transfers.rb +1 -1
  116. data/db/migrate/20140205120320_create_spree_payment_capture_events.rb +1 -1
  117. data/db/migrate/20140309023735_migrate_old_preferences.rb +5 -1
  118. data/db/migrate/20140309024355_create_spree_stores.rb +1 -1
  119. data/db/migrate/20140625214618_create_spree_refunds.rb +1 -1
  120. data/db/migrate/20140702140656_create_spree_return_authorization_inventory_unit.rb +1 -1
  121. data/db/migrate/20140713140455_create_spree_return_authorization_reasons.rb +1 -1
  122. data/db/migrate/20140713140527_create_spree_refund_reasons.rb +1 -1
  123. data/db/migrate/20140715182625_create_spree_promotion_categories.rb +1 -1
  124. data/db/migrate/20140718133010_create_spree_customer_returns.rb +1 -1
  125. data/db/migrate/20140725131539_create_spree_reimbursements.rb +1 -1
  126. data/db/migrate/20140731150017_create_spree_reimbursement_types.rb +1 -1
  127. data/db/migrate/20150118210639_create_spree_store_credits.rb +1 -1
  128. data/db/migrate/20150118211500_create_spree_store_credit_categories.rb +1 -1
  129. data/db/migrate/20150118212051_create_spree_store_credit_events.rb +1 -1
  130. data/db/migrate/20150118212101_create_spree_store_credit_types.rb +1 -1
  131. data/db/migrate/20150309161154_ensure_payments_have_numbers.rb +6 -2
  132. data/db/migrate/20180613080857_rename_guest_token_to_token_in_orders.rb +5 -0
  133. data/db/migrate/20180915160001_add_timestamps_to_spree_prices.rb +12 -0
  134. data/db/migrate/20181024100754_add_deleted_at_to_spree_credit_cards.rb +6 -0
  135. data/lib/generators/spree/custom_user/custom_user_generator.rb +1 -3
  136. data/lib/generators/spree/dummy/dummy_generator.rb +30 -33
  137. data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
  138. data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
  139. data/lib/generators/spree/dummy_model/dummy_model_generator.rb +1 -1
  140. data/lib/generators/spree/install/install_generator.rb +2 -1
  141. data/lib/spree/core.rb +2 -4
  142. data/lib/spree/core/controller_helpers/auth.rb +15 -5
  143. data/lib/spree/core/controller_helpers/common.rb +0 -11
  144. data/lib/spree/core/controller_helpers/order.rb +6 -6
  145. data/lib/spree/core/controller_helpers/respond_with.rb +3 -1
  146. data/lib/spree/core/controller_helpers/strong_parameters.rb +1 -0
  147. data/lib/spree/core/engine.rb +9 -3
  148. data/lib/spree/core/importer/order.rb +8 -12
  149. data/lib/spree/core/product_duplicator.rb +6 -1
  150. data/lib/spree/core/product_filters.rb +15 -14
  151. data/lib/spree/core/query_filters.rb +11 -0
  152. data/lib/spree/core/query_filters/comparable.rb +46 -0
  153. data/lib/spree/core/query_filters/date.rb +8 -0
  154. data/lib/spree/core/query_filters/number.rb +8 -0
  155. data/lib/spree/core/query_filters/text.rb +32 -0
  156. data/lib/spree/core/token_generator.rb +2 -2
  157. data/lib/spree/core/version.rb +1 -1
  158. data/lib/spree/i18n.rb +1 -1
  159. data/lib/spree/migrations.rb +2 -0
  160. data/lib/spree/money.rb +12 -12
  161. data/lib/spree/permitted_attributes.rb +11 -6
  162. data/lib/spree/service_module.rb +98 -0
  163. data/lib/spree/testing_support/capybara_config.rb +20 -0
  164. data/lib/spree/testing_support/capybara_ext.rb +6 -3
  165. data/lib/spree/testing_support/factories.rb +1 -1
  166. data/lib/spree/testing_support/factories/address_factory.rb +10 -9
  167. data/lib/spree/testing_support/factories/adjustment_factory.rb +8 -6
  168. data/lib/spree/testing_support/factories/country_factory.rb +4 -4
  169. data/lib/spree/testing_support/factories/credit_card_factory.rb +7 -5
  170. data/lib/spree/testing_support/factories/customer_return_factory.rb +1 -1
  171. data/lib/spree/testing_support/factories/image_factory.rb +7 -1
  172. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +5 -4
  173. data/lib/spree/testing_support/factories/line_item_factory.rb +3 -2
  174. data/lib/spree/testing_support/factories/options_factory.rb +2 -3
  175. data/lib/spree/testing_support/factories/order_factory.rb +16 -12
  176. data/lib/spree/testing_support/factories/order_promotion_factory.rb +6 -0
  177. data/lib/spree/testing_support/factories/payment_factory.rb +9 -7
  178. data/lib/spree/testing_support/factories/payment_method_factory.rb +8 -8
  179. data/lib/spree/testing_support/factories/price_factory.rb +2 -2
  180. data/lib/spree/testing_support/factories/product_factory.rb +10 -10
  181. data/lib/spree/testing_support/factories/promotion_category_factory.rb +1 -1
  182. data/lib/spree/testing_support/factories/promotion_factory.rb +14 -4
  183. data/lib/spree/testing_support/factories/property_factory.rb +2 -2
  184. data/lib/spree/testing_support/factories/prototype_factory.rb +3 -3
  185. data/lib/spree/testing_support/factories/refund_factory.rb +6 -6
  186. data/lib/spree/testing_support/factories/reimbursement_factory.rb +1 -1
  187. data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +2 -2
  188. data/lib/spree/testing_support/factories/return_authorization_factory.rb +4 -3
  189. data/lib/spree/testing_support/factories/role_factory.rb +1 -1
  190. data/lib/spree/testing_support/factories/shipment_factory.rb +3 -3
  191. data/lib/spree/testing_support/factories/shipping_method_factory.rb +4 -4
  192. data/lib/spree/testing_support/factories/state_factory.rb +2 -5
  193. data/lib/spree/testing_support/factories/stock_factory.rb +3 -3
  194. data/lib/spree/testing_support/factories/stock_item_factory.rb +1 -1
  195. data/lib/spree/testing_support/factories/stock_location_factory.rb +7 -7
  196. data/lib/spree/testing_support/factories/stock_movement_factory.rb +3 -3
  197. data/lib/spree/testing_support/factories/store_credit_category_factory.rb +2 -2
  198. data/lib/spree/testing_support/factories/store_credit_type_factory.rb +1 -1
  199. data/lib/spree/testing_support/factories/store_factory.rb +5 -4
  200. data/lib/spree/testing_support/factories/tax_rate_factory.rb +2 -1
  201. data/lib/spree/testing_support/factories/user_factory.rb +4 -4
  202. data/lib/spree/testing_support/factories/variant_factory.rb +15 -15
  203. data/lib/spree/testing_support/factories/zone_factory.rb +3 -3
  204. data/lib/spree/testing_support/image_helpers.rb +19 -0
  205. data/lib/tasks/core.rake +21 -4
  206. data/lib/tasks/exchanges.rake +4 -4
  207. data/spree_core.gemspec +3 -3
  208. data/vendor/assets/javascripts/fetch.umd.js +531 -0
  209. data/vendor/assets/javascripts/polyfill.min.js +1 -0
  210. metadata +50 -17
  211. data/app/assets/javascripts/spree.js.coffee +0 -59
  212. data/app/models/spree/taxon_icon.rb +0 -5
  213. data/lib/generators/spree/dummy/templates/initializers/custom_user.rb +0 -1
  214. data/lib/spree/core/environment.rb +0 -15
  215. data/lib/spree/core/environment/calculators.rb +0 -11
  216. data/lib/spree/core/environment_extension.rb +0 -28
  217. data/lib/spree/core/validators/email.rb +0 -8
  218. data/lib/spree/promo/environment.rb +0 -9
@@ -11,7 +11,7 @@ Carmen::Country.all.each do |country|
11
11
  ).first_or_create
12
12
  end
13
13
 
14
- Spree::Config[:default_country_id] = Spree::Country.find_by(iso: "US").id
14
+ Spree::Config[:default_country_id] = Spree::Country.find_by(iso: 'US').id
15
15
 
16
16
  # find countries that do not use postal codes (by iso) and set 'zipcode_required' to false for them.
17
17
 
@@ -1 +1 @@
1
- Spree::RefundReason.find_or_create_by!(name: "Return processing", mutable: false)
1
+ Spree::RefundReason.find_or_create_by!(name: 'Return processing', mutable: false)
@@ -1,2 +1,2 @@
1
- Spree::Role.where(name: "admin").first_or_create
2
- Spree::Role.where(name: "user").first_or_create
1
+ Spree::Role.where(name: 'admin').first_or_create
2
+ Spree::Role.where(name: 'user').first_or_create
@@ -1,6 +1,7 @@
1
1
  Spree::Country.where(states_required: true).each do |country|
2
2
  carmen_country = Carmen::Country.named(country.name)
3
- next if !carmen_country
3
+ next unless carmen_country
4
+
4
5
  carmen_country.subregions.each do |subregion|
5
6
  country.states.where(
6
7
  name: subregion.name,
@@ -6,4 +6,4 @@ unless Spree::Store.where(code: 'spree').exists?
6
6
  s.url = 'example.com'
7
7
  s.mail_from_address = 'spree@example.com'
8
8
  end.save!
9
- end
9
+ end
@@ -1,11 +1,10 @@
1
- eu_vat = Spree::Zone.create!(name: "EU_VAT", description: "Countries that make up the EU VAT zone.", kind: 'country')
2
- north_america = Spree::Zone.create!(name: "North America", description: "USA + Canada", kind: 'country')
1
+ eu_vat = Spree::Zone.where(name: 'EU_VAT', description: 'Countries that make up the EU VAT zone.', kind: 'country').first_or_create!
2
+ north_america = Spree::Zone.where(name: 'North America', description: 'USA + Canada', kind: 'country').first_or_create!
3
3
 
4
- %w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG GB LT CY LU MT DK NL EE HR CZ GR).
5
- each do |name|
6
- eu_vat.zone_members.create!(zoneable: Spree::Country.find_by!(iso: name))
4
+ %w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG GB LT CY LU MT DK NL EE HR CZ GR).each do |name|
5
+ eu_vat.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
7
6
  end
8
7
 
9
8
  %w(US CA).each do |name|
10
- north_america.zone_members.create!(zoneable: Spree::Country.find_by!(iso: name))
9
+ north_america.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
11
10
  end
@@ -18,7 +18,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
18
18
  t.string :code
19
19
  t.boolean :advertise, default: false
20
20
  t.string :path
21
- t.timestamps null: false
21
+ t.timestamps null: false, precision: 6
22
22
  end
23
23
 
24
24
  create_table :spree_addresses do |t|
@@ -34,7 +34,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
34
34
  t.string :company
35
35
  t.references :state
36
36
  t.references :country
37
- t.timestamps null: false
37
+ t.timestamps null: false, precision: 6
38
38
  end
39
39
 
40
40
  add_index :spree_addresses, [:firstname], name: 'index_addresses_on_firstname'
@@ -49,7 +49,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
49
49
  t.boolean :mandatory
50
50
  t.boolean :locked
51
51
  t.boolean :eligible, default: true
52
- t.timestamps null: false
52
+ t.timestamps null: false, precision: 6
53
53
  end
54
54
 
55
55
  add_index :spree_adjustments, [:adjustable_id], name: 'index_adjustments_on_order_id'
@@ -73,13 +73,13 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
73
73
  create_table :spree_calculators do |t|
74
74
  t.string :type
75
75
  t.references :calculable, polymorphic: true
76
- t.timestamps null: false
76
+ t.timestamps null: false, precision: 6
77
77
  end
78
78
 
79
79
  create_table :spree_configurations do |t|
80
80
  t.string :name
81
81
  t.string :type, limit: 50
82
- t.timestamps null: false
82
+ t.timestamps null: false, precision: 6
83
83
  end
84
84
 
85
85
  add_index :spree_configurations, [:name, :type], name: 'index_spree_configurations_on_name_and_type'
@@ -105,7 +105,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
105
105
  t.references :address
106
106
  t.string :gateway_customer_profile_id
107
107
  t.string :gateway_payment_profile_id
108
- t.timestamps null: false
108
+ t.timestamps null: false, precision: 6
109
109
  end
110
110
 
111
111
  create_table :spree_gateways do |t|
@@ -116,7 +116,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
116
116
  t.string :environment, default: 'development'
117
117
  t.string :server, default: 'test'
118
118
  t.boolean :test_mode, default: true
119
- t.timestamps null: false
119
+ t.timestamps null: false, precision: 6
120
120
  end
121
121
 
122
122
  create_table :spree_inventory_units do |t|
@@ -126,7 +126,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
126
126
  t.references :order
127
127
  t.references :shipment
128
128
  t.references :return_authorization
129
- t.timestamps null: false
129
+ t.timestamps null: false, precision: 6
130
130
  end
131
131
 
132
132
  add_index :spree_inventory_units, [:order_id], name: 'index_inventory_units_on_order_id'
@@ -138,7 +138,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
138
138
  t.references :order
139
139
  t.integer :quantity, null: false
140
140
  t.decimal :price, precision: 8, scale: 2, null: false
141
- t.timestamps null: false
141
+ t.timestamps null: false, precision: 6
142
142
  end
143
143
 
144
144
  add_index :spree_line_items, [:order_id], name: 'index_spree_line_items_on_order_id'
@@ -147,20 +147,20 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
147
147
  create_table :spree_log_entries do |t|
148
148
  t.references :source, polymorphic: true
149
149
  t.text :details
150
- t.timestamps null: false
150
+ t.timestamps null: false, precision: 6
151
151
  end
152
152
 
153
153
  create_table :spree_mail_methods do |t|
154
154
  t.string :environment
155
155
  t.boolean :active, default: true
156
- t.timestamps null: false
156
+ t.timestamps null: false, precision: 6
157
157
  end
158
158
 
159
159
  create_table :spree_option_types do |t|
160
160
  t.string :name, limit: 100
161
161
  t.string :presentation, limit: 100
162
162
  t.integer :position, default: 0, null: false
163
- t.timestamps null: false
163
+ t.timestamps null: false, precision: 6
164
164
  end
165
165
 
166
166
  create_table :spree_option_types_prototypes, id: false do |t|
@@ -173,7 +173,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
173
173
  t.string :name
174
174
  t.string :presentation
175
175
  t.references :option_type
176
- t.timestamps null: false
176
+ t.timestamps null: false, precision: 6
177
177
  end
178
178
 
179
179
  create_table :spree_option_values_variants, id: false do |t|
@@ -200,7 +200,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
200
200
  t.string :payment_state
201
201
  t.string :email
202
202
  t.text :special_instructions
203
- t.timestamps null: false
203
+ t.timestamps null: false, precision: 6
204
204
  end
205
205
 
206
206
  add_index :spree_orders, [:number], name: 'index_spree_orders_on_number'
@@ -213,7 +213,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
213
213
  t.string :environment, default: 'development'
214
214
  t.datetime :deleted_at
215
215
  t.string :display_on
216
- t.timestamps null: false
216
+ t.timestamps null: false, precision: 6
217
217
  end
218
218
 
219
219
  create_table :spree_payments do |t|
@@ -224,7 +224,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
224
224
  t.string :state
225
225
  t.string :response_code
226
226
  t.string :avs_response
227
- t.timestamps null: false
227
+ t.timestamps null: false, precision: 6
228
228
  end
229
229
 
230
230
  create_table :spree_preferences do |t|
@@ -233,7 +233,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
233
233
  t.text :value
234
234
  t.string :key
235
235
  t.string :value_type
236
- t.timestamps null: false
236
+ t.timestamps null: false, precision: 6
237
237
  end
238
238
 
239
239
  add_index :spree_preferences, [:key], name: 'index_spree_preferences_on_key', unique: true
@@ -242,14 +242,14 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
242
242
  t.integer :position
243
243
  t.references :product
244
244
  t.references :option_type
245
- t.timestamps null: false
245
+ t.timestamps null: false, precision: 6
246
246
  end
247
247
 
248
248
  create_table :spree_product_properties do |t|
249
249
  t.string :value
250
250
  t.references :product
251
251
  t.references :property
252
- t.timestamps null: false
252
+ t.timestamps null: false, precision: 6
253
253
  end
254
254
 
255
255
  add_index :spree_product_properties, [:product_id], name: 'index_product_properties_on_product_id'
@@ -265,7 +265,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
265
265
  t.references :tax_category
266
266
  t.references :shipping_category
267
267
  t.integer :count_on_hand, default: 0, null: false
268
- t.timestamps null: false
268
+ t.timestamps null: false, precision: 6
269
269
  end
270
270
 
271
271
  add_index :spree_products, [:available_on], name: 'index_spree_products_on_available_on'
@@ -284,7 +284,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
284
284
  create_table :spree_properties do |t|
285
285
  t.string :name
286
286
  t.string :presentation, null: false
287
- t.timestamps null: false
287
+ t.timestamps null: false, precision: 6
288
288
  end
289
289
 
290
290
  create_table :spree_properties_prototypes, id: false do |t|
@@ -294,7 +294,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
294
294
 
295
295
  create_table :spree_prototypes do |t|
296
296
  t.string :name
297
- t.timestamps null: false
297
+ t.timestamps null: false, precision: 6
298
298
  end
299
299
 
300
300
  create_table :spree_return_authorizations do |t|
@@ -303,7 +303,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
303
303
  t.decimal :amount, precision: 8, scale: 2, default: 0.0, null: false
304
304
  t.references :order
305
305
  t.text :reason
306
- t.timestamps null: false
306
+ t.timestamps null: false, precision: 6
307
307
  end
308
308
 
309
309
  create_table :spree_roles do |t|
@@ -327,14 +327,14 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
327
327
  t.references :shipping_method
328
328
  t.references :address
329
329
  t.string :state
330
- t.timestamps null: false
330
+ t.timestamps null: false, precision: 6
331
331
  end
332
332
 
333
333
  add_index :spree_shipments, [:number], name: 'index_shipments_on_number'
334
334
 
335
335
  create_table :spree_shipping_categories do |t|
336
336
  t.string :name
337
- t.timestamps null: false
337
+ t.timestamps null: false, precision: 6
338
338
  end
339
339
 
340
340
  create_table :spree_shipping_methods do |t|
@@ -346,7 +346,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
346
346
  t.boolean :match_all
347
347
  t.boolean :match_one
348
348
  t.datetime :deleted_at
349
- t.timestamps null: false
349
+ t.timestamps null: false, precision: 6
350
350
  end
351
351
 
352
352
  create_table :spree_state_changes do |t|
@@ -356,7 +356,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
356
356
  t.references :user
357
357
  t.string :stateful_type
358
358
  t.string :next_state
359
- t.timestamps null: false
359
+ t.timestamps null: false, precision: 6
360
360
  end
361
361
 
362
362
  create_table :spree_states do |t|
@@ -370,7 +370,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
370
370
  t.string :description
371
371
  t.boolean :is_default, default: false
372
372
  t.datetime :deleted_at
373
- t.timestamps null: false
373
+ t.timestamps null: false, precision: 6
374
374
  end
375
375
 
376
376
  create_table :spree_tax_rates do |t|
@@ -378,12 +378,12 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
378
378
  t.references :zone
379
379
  t.references :tax_category
380
380
  t.boolean :included_in_price, default: false
381
- t.timestamps null: false
381
+ t.timestamps null: false, precision: 6
382
382
  end
383
383
 
384
384
  create_table :spree_taxonomies do |t|
385
385
  t.string :name, null: false
386
- t.timestamps null: false
386
+ t.timestamps null: false, precision: 6
387
387
  end
388
388
 
389
389
  create_table :spree_taxons do |t|
@@ -399,7 +399,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
399
399
  t.integer :icon_file_size
400
400
  t.datetime :icon_updated_at
401
401
  t.text :description
402
- t.timestamps null: false
402
+ t.timestamps null: false, precision: 6
403
403
  end
404
404
 
405
405
  add_index :spree_taxons, [:parent_id], name: 'index_taxons_on_parent_id'
@@ -409,7 +409,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
409
409
  create_table :spree_tokenized_permissions, force: true do |t|
410
410
  t.references :permissable, polymorphic: true
411
411
  t.string :token
412
- t.timestamps null: false
412
+ t.timestamps null: false, precision: 6
413
413
  end
414
414
 
415
415
  add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], name: 'index_tokenized_name_and_type'
@@ -418,7 +418,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
418
418
  t.string :environment
419
419
  t.string :analytics_id
420
420
  t.boolean :active, default: true
421
- t.timestamps null: false
421
+ t.timestamps null: false, precision: 6
422
422
  end
423
423
 
424
424
  create_table :spree_users do |t|
@@ -444,7 +444,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
444
444
  t.datetime :locked_at
445
445
  t.datetime :remember_created_at
446
446
  t.datetime :reset_password_sent_at
447
- t.timestamps null: false
447
+ t.timestamps null: false, precision: 6
448
448
  end
449
449
 
450
450
  create_table :spree_variants do |t|
@@ -467,7 +467,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
467
467
  create_table :spree_zone_members do |t|
468
468
  t.references :zoneable, polymorphic: true
469
469
  t.references :zone
470
- t.timestamps null: false
470
+ t.timestamps null: false, precision: 6
471
471
  end
472
472
 
473
473
  create_table :spree_zones do |t|
@@ -475,7 +475,7 @@ class SpreeOneTwo < ActiveRecord::Migration[4.2]
475
475
  t.string :description
476
476
  t.boolean :default_tax, default: false
477
477
  t.integer :zone_members_count, default: 0
478
- t.timestamps null: false
478
+ t.timestamps null: false, precision: 6
479
479
  end
480
480
  end
481
481
  end
@@ -28,7 +28,7 @@ class SpreePromoOneTwo < ActiveRecord::Migration[4.2]
28
28
  t.references :user
29
29
  t.references :product_group
30
30
  t.string :type
31
- t.timestamps null: false
31
+ t.timestamps null: false, precision: 6
32
32
  end
33
33
 
34
34
  add_index :spree_promotion_rules, [:product_group_id], name: 'index_promotion_rules_on_product_group_id'
@@ -6,7 +6,7 @@ class CreateSpreeStockItems < ActiveRecord::Migration[4.2]
6
6
  t.integer :count_on_hand, null: false, default: 0
7
7
  t.integer :lock_version
8
8
 
9
- t.timestamps null: false
9
+ t.timestamps null: false, precision: 6
10
10
  end
11
11
  add_index :spree_stock_items, :stock_location_id
12
12
  add_index :spree_stock_items, [:stock_location_id, :variant_id], name: 'stock_item_by_loc_and_var_id'
@@ -4,7 +4,7 @@ class CreateSpreeStockLocations < ActiveRecord::Migration[4.2]
4
4
  t.string :name
5
5
  t.belongs_to :address
6
6
 
7
- t.timestamps null: false
7
+ t.timestamps null: false, precision: 6
8
8
  end
9
9
  add_index :spree_stock_locations, :address_id
10
10
  end
@@ -4,7 +4,7 @@ class CreateShippingMethodCategories < ActiveRecord::Migration[4.2]
4
4
  t.integer :shipping_method_id, null: false
5
5
  t.integer :shipping_category_id, null: false
6
6
 
7
- t.timestamps null: false
7
+ t.timestamps null: false, precision: 6
8
8
  end
9
9
 
10
10
  add_index :spree_shipping_method_categories, :shipping_method_id
@@ -5,7 +5,7 @@ class CreateSpreeShippingRates < ActiveRecord::Migration[4.2]
5
5
  t.belongs_to :shipping_method
6
6
  t.boolean :selected, default: false
7
7
  t.decimal :cost, precision: 8, scale: 2
8
- t.timestamps null: false
8
+ t.timestamps null: false, precision: 6
9
9
  end
10
10
  add_index(:spree_shipping_rates, [:shipment_id, :shipping_method_id],
11
11
  name: 'spree_shipping_rates_join_index',
@@ -5,7 +5,7 @@ class CreateStockMovements < ActiveRecord::Migration[4.2]
5
5
  t.integer :quantity
6
6
  t.string :action
7
7
 
8
- t.timestamps null: false
8
+ t.timestamps null: false, precision: 6
9
9
  end
10
10
  add_index :spree_stock_movements, :stock_item_id
11
11
  end
@@ -5,7 +5,7 @@ class CreateSpreeStockTransfers < ActiveRecord::Migration[4.2]
5
5
  t.string :reference_number
6
6
  t.integer :source_location_id
7
7
  t.integer :destination_location_id
8
- t.timestamps null: false
8
+ t.timestamps null: false, precision: 6
9
9
  end
10
10
 
11
11
  add_index :spree_stock_transfers, :source_location_id
@@ -4,7 +4,7 @@ class CreateSpreePaymentCaptureEvents < ActiveRecord::Migration[4.2]
4
4
  t.decimal :amount, precision: 10, scale: 2, default: 0.0
5
5
  t.integer :payment_id
6
6
 
7
- t.timestamps null: false
7
+ t.timestamps null: false, precision: 6
8
8
  end
9
9
 
10
10
  add_index :spree_payment_capture_events, :payment_id
@@ -1,6 +1,10 @@
1
1
  class MigrateOldPreferences < ActiveRecord::Migration[4.2]
2
2
  def up
3
- migrate_preferences(Spree::Calculator)
3
+ if Spree::Calculator.respond_to?(:with_deleted)
4
+ migrate_preferences(Spree::Calculator.with_deleted)
5
+ else
6
+ migrate_preferences(Spree::Calculator)
7
+ end
4
8
  migrate_preferences(Spree::PaymentMethod)
5
9
  migrate_preferences(Spree::PromotionRule)
6
10
  end