spree_purchase_order 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/db/migrate/20160111123141_create_spree_purchase_orders.rb +1 -1
  3. data/db/migrate/20161214190805_add_payment_method_id_to_spree_purchase_orders.rb +1 -1
  4. data/db/migrate/20161214191512_add_user_id_to_spree_purchase_orders.rb +1 -1
  5. data/lib/spree_purchase_order/version.rb +1 -1
  6. data/spec/dummy/config/application.rb +0 -2
  7. data/spec/dummy/db/migrate/20180516191805_add_quantity_to_inventory_units.spree.rb +6 -0
  8. data/spec/dummy/db/migrate/20180516191806_add_original_return_item_id_to_spree_inventory_units.spree.rb +30 -0
  9. data/spec/dummy/db/migrate/20180516191807_add_unique_index_on_number_to_spree_orders.spree.rb +17 -0
  10. data/spec/dummy/db/migrate/20180516191808_add_unique_index_on_number_to_spree_stock_transfer.spree.rb +17 -0
  11. data/spec/dummy/db/migrate/20180516191809_add_unique_index_on_number_to_spree_shipment.spree.rb +17 -0
  12. data/spec/dummy/db/migrate/20180516191810_add_unique_index_on_number_to_spree_payments.spree.rb +18 -0
  13. data/spec/dummy/db/migrate/20180516191811_add_unique_index_on_number_to_spree_return_authorizations.spree.rb +17 -0
  14. data/spec/dummy/db/migrate/20180516191812_add_unique_index_on_number_to_spree_customer_returns.spree.rb +17 -0
  15. data/spec/dummy/db/migrate/20180516191813_add_unique_index_on_number_to_spree_reimbursements.spree.rb +17 -0
  16. data/spec/dummy/db/migrate/20180516191814_add_missing_unique_indexes_for_unique_attributes.spree.rb +38 -0
  17. data/spec/dummy/db/migrate/20180516191815_add_index_on_stock_location_to_spree_customer_returns.spree.rb +6 -0
  18. data/spec/dummy/db/migrate/20180516191816_add_index_on_prototype_to_spree_option_type_prototype.spree.rb +20 -0
  19. data/spec/dummy/db/migrate/20180516191817_add_indexes_to_spree_option_value_variant.spree.rb +20 -0
  20. data/spec/dummy/db/migrate/20180516191818_add_index_on_promotion_id_to_order_promotions.spree.rb +6 -0
  21. data/spec/dummy/db/migrate/20180516191819_add_indexes_for_property_prototype.spree.rb +21 -0
  22. data/spec/dummy/db/migrate/20180516191820_add_index_for_prototype_id_to_prototype_taxons.spree.rb +6 -0
  23. data/spec/dummy/db/migrate/20180516191821_add_indexes_to_refunds.spree.rb +7 -0
  24. data/spec/dummy/db/migrate/20180516191822_add_indexes_to_reimbursement_credits.spree.rb +7 -0
  25. data/spec/dummy/db/migrate/20180516191823_add_indexes_to_return_authorizations.spree.rb +7 -0
  26. data/spec/dummy/db/migrate/20180516191824_add_indexes_to_return_items.spree.rb +12 -0
  27. data/spec/dummy/db/migrate/20180516191825_add_index_to_role_users.spree.rb +19 -0
  28. data/spec/dummy/db/migrate/20180516191826_add_index_to_shipping_method_categories.spree.rb +6 -0
  29. data/spec/dummy/db/migrate/20180516191827_add_index_to_shipping_method_zones.spree.rb +21 -0
  30. data/spec/dummy/db/migrate/20180516191828_add_index_to_spree_shipping_rates.spree.rb +7 -0
  31. data/spec/dummy/db/migrate/20180516191829_add_index_to_spree_stock_items.spree.rb +6 -0
  32. data/spec/dummy/db/migrate/20180516191830_add_index_to_spree_stock_movement.spree.rb +6 -0
  33. data/spec/dummy/db/migrate/20180516191831_change_indexes_on_friendly_id_slugs.spree.rb +11 -0
  34. data/spec/dummy/db/migrate/20180516191832_add_analytics_kind_to_spree_trackers.spree.rb +6 -0
  35. data/spec/dummy/db/migrate/20180516191833_rename_tracker_kind_field.spree.rb +6 -0
  36. data/spec/dummy/db/schema.rb +553 -517
  37. data/spec/dummy/db/test.sqlite3 +0 -0
  38. data/spec/dummy/log/test.log +3913 -0
  39. metadata +62 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 727d8ce24fbc909265ca679814e933c92d6201ae
4
- data.tar.gz: 12c9c0ff01500a18456caebd59ecea84617a9e43
3
+ metadata.gz: 45b1dc4a8ec8ad4a0570995dc77645b4debe6e05
4
+ data.tar.gz: 3ffdc47367fa2e2158a958a11caf5ffab7d08f8e
5
5
  SHA512:
6
- metadata.gz: 73cc1a2fe0a348047f2939a1bc1b134b5ec1f63294f93916601c27c90ff94fef928824b1ad4598061d2f8a5c10dcb3362157950d0b2f41bc80e66ae6e25f3170
7
- data.tar.gz: 2d5d717898a90809f107b9862ea24316c435589a98eba3ab30738b309e3ae5ac60d79e2f52b67d48f2c9e765a22521d4b5ee5b7d64fecac6f71f6cdd2f8dd613
6
+ metadata.gz: ac48dbd487e74079b9058fd8681019db9c7f228c2210a3217bab19afcc32a86659d4d19ee8a44be4af73dabdb52a9b4728bde4bbeda7e9a51631744f494ab56e
7
+ data.tar.gz: 61ae6bce21914b3b0e870060c88b7eee34f276f50e181f99e7a131a9ef974db871de0ab9fa7a6850c7faed131a0fa0395ce9635716ae9d11b997ea20d5dd944d
@@ -1,4 +1,4 @@
1
- class CreateSpreePurchaseOrders < ActiveRecord::Migration
1
+ class CreateSpreePurchaseOrders < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spree_purchase_orders do |t|
4
4
  t.string :po_number
@@ -1,4 +1,4 @@
1
- class AddPaymentMethodIdToSpreePurchaseOrders < ActiveRecord::Migration
1
+ class AddPaymentMethodIdToSpreePurchaseOrders < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_purchase_orders, :payment_method_id, :integer
4
4
  add_index :spree_purchase_orders, :payment_method_id
@@ -1,4 +1,4 @@
1
- class AddUserIdToSpreePurchaseOrders < ActiveRecord::Migration
1
+ class AddUserIdToSpreePurchaseOrders < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spree_purchase_orders, :user_id, :integer
4
4
  add_index :spree_purchase_orders, :user_id
@@ -1,3 +1,3 @@
1
1
  module SpreePurchaseOrder
2
- VERSION = '3.2.0'
2
+ VERSION = '3.3.0'
3
3
  end
@@ -21,8 +21,6 @@ module Dummy
21
21
  Rails.configuration.cache_classes ? require(c) : load(c)
22
22
  end
23
23
  end
24
-
25
- config.active_record.raise_in_transactional_callbacks = true
26
24
  end
27
25
  end
28
26
 
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20161125065505)
2
+ class AddQuantityToInventoryUnits < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_column :spree_inventory_units, :quantity, :integer, default: 1
5
+ end
6
+ end
@@ -0,0 +1,30 @@
1
+ # This migration comes from spree (originally 20170119122701)
2
+ class AddOriginalReturnItemIdToSpreeInventoryUnits < ActiveRecord::Migration[5.0]
3
+ def up
4
+ add_reference :spree_inventory_units, :original_return_item, references: :spree_return_items, index: true
5
+
6
+ Spree::InventoryUnit.reset_column_information
7
+
8
+ Spree::ReturnItem.where.not(exchange_inventory_unit_id: nil).find_each do |return_item|
9
+ if (inventory_unit = Spree::InventoryUnit.find_by(id: return_item.exchange_inventory_unit_id)).present?
10
+ inventory_unit.update_column(:original_return_item_id, return_item.id)
11
+ end
12
+ end
13
+
14
+ remove_column :spree_return_items, :exchange_inventory_unit_id
15
+ end
16
+
17
+ def down
18
+ add_reference :spree_return_items, :exchange_inventory_unit, references: :spree_inventory_units, index: true
19
+
20
+ Spree::InventoryUnit.reset_column_information
21
+
22
+ Spree::InventoryUnit.where.not(original_return_item_id: nil).find_each do |inventory_unit|
23
+ if (return_item = Spree::ReturnItem.find_by(id: inventory_unit.original_return_item_id)).present?
24
+ return_item.update_column(:exchange_inventory_unit_id, inventory_unit.id)
25
+ end
26
+ end
27
+
28
+ remove_reference :spree_inventory_units, :original_return_item
29
+ end
30
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from spree (originally 20170315152755)
2
+ class AddUniqueIndexOnNumberToSpreeOrders < ActiveRecord::Migration[5.0]
3
+ def change
4
+ unless index_exists?(:spree_orders, :number, unique: true)
5
+ numbers = Spree::Order.group(:number).having('sum(1) > 1').pluck(:number)
6
+ orders = Spree::Order.where(number: numbers)
7
+
8
+ orders.find_each do |order|
9
+ order.number = order.class.number_generator.method(:generate_permalink).call(order.class)
10
+ order.save
11
+ end
12
+
13
+ remove_index :spree_orders, :number if index_exists?(:spree_orders, :number)
14
+ add_index :spree_orders, :number, unique: true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from spree (originally 20170316154338)
2
+ class AddUniqueIndexOnNumberToSpreeStockTransfer < ActiveRecord::Migration[5.0]
3
+ def change
4
+ unless index_exists?(:spree_stock_transfers, :number, unique: true)
5
+ numbers = Spree::StockTransfer.group(:number).having('sum(1) > 1').pluck(:number)
6
+ transfers = Spree::StockTransfer.where(number: numbers)
7
+
8
+ transfers.find_each do |transfer|
9
+ transfer.number = transfer.class.number_generator.method(:generate_permalink).call(transfer.class)
10
+ transfer.save
11
+ end
12
+
13
+ remove_index :spree_stock_transfers, :number if index_exists?(:spree_stock_transfers, :number)
14
+ add_index :spree_stock_transfers, :number, unique: true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from spree (originally 20170316205511)
2
+ class AddUniqueIndexOnNumberToSpreeShipment < ActiveRecord::Migration[5.0]
3
+ def change
4
+ unless index_exists?(:spree_shipments, :number, unique: true)
5
+ numbers = Spree::Shipment.group(:number).having('sum(1) > 1').pluck(:number)
6
+ shipments = Spree::Shipment.where(number: numbers)
7
+
8
+ shipments.find_each do |shipment|
9
+ shipment.number = shipment.class.number_generator.method(:generate_permalink).call(shipment.class)
10
+ shipment.save
11
+ end
12
+
13
+ remove_index :spree_shipments, :number if index_exists?(:spree_shipments, :number)
14
+ add_index :spree_shipments, :number, unique: true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ # This migration comes from spree (originally 20170320134043)
2
+ class AddUniqueIndexOnNumberToSpreePayments < ActiveRecord::Migration[5.0]
3
+ def change
4
+ unless index_exists?(:spree_payments, :number, unique: true)
5
+ # default scope in Spree::Payment disturbs Postgres, hence `unscoped` is needed.
6
+ numbers = Spree::Payment.unscoped.group(:number).having('sum(1) > 1').pluck(:number)
7
+ payments = Spree::Payment.where(number: numbers)
8
+
9
+ payments.find_each do |payment|
10
+ payment.number = payment.class.number_generator.method(:generate_permalink).call(payment.class)
11
+ payment.save
12
+ end
13
+
14
+ remove_index :spree_payments, :number if index_exists?(:spree_payments, :number)
15
+ add_index :spree_payments, :number, unique: true
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from spree (originally 20170320142750)
2
+ class AddUniqueIndexOnNumberToSpreeReturnAuthorizations < ActiveRecord::Migration[5.0]
3
+ def change
4
+ unless index_exists?(:spree_return_authorizations, :number, unique: true)
5
+ numbers = Spree::ReturnAuthorization.group(:number).having('sum(1) > 1').pluck(:number)
6
+ authorizations = Spree::ReturnAuthorization.where(number: numbers)
7
+
8
+ authorizations.find_each do |authorization|
9
+ authorization.number = authorization.class.number_generator.method(:generate_permalink).call(authorization.class)
10
+ authorization.save
11
+ end
12
+
13
+ remove_index :spree_return_authorizations, :number if index_exists?(:spree_return_authorizations, :number)
14
+ add_index :spree_return_authorizations, :number, unique: true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from spree (originally 20170320145040)
2
+ class AddUniqueIndexOnNumberToSpreeCustomerReturns < ActiveRecord::Migration[5.0]
3
+ def change
4
+ unless index_exists?(:spree_customer_returns, :number, unique: true)
5
+ numbers = Spree::CustomerReturn.group(:number).having('sum(1) > 1').pluck(:number)
6
+ returns = Spree::CustomerReturn.where(number: numbers)
7
+
8
+ returns.find_each do |r|
9
+ r.number = r.class.number_generator.method(:generate_permalink).call(r.class)
10
+ r.save
11
+ end
12
+
13
+ remove_index :spree_customer_returns, :number if index_exists?(:spree_customer_returns, :number)
14
+ add_index :spree_customer_returns, :number, unique: true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from spree (originally 20170320145518)
2
+ class AddUniqueIndexOnNumberToSpreeReimbursements < ActiveRecord::Migration[5.0]
3
+ def change
4
+ unless index_exists?(:spree_reimbursements, :number, unique: true)
5
+ numbers = Spree::Reimbursement.group(:number).having('sum(1) > 1').pluck(:number)
6
+ reimbursements = Spree::Reimbursement.where(number: numbers)
7
+
8
+ reimbursements.find_each do |reimbursement|
9
+ reimbursement.number = reimbursement.class.number_generator.method(:generate_permalink).call(reimbursement.class)
10
+ reimbursement.save
11
+ end
12
+
13
+ remove_index :spree_reimbursements, :number if index_exists?(:spree_reimbursements, :number)
14
+ add_index :spree_reimbursements, :number, unique: true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,38 @@
1
+ # This migration comes from spree (originally 20170323151450)
2
+ class AddMissingUniqueIndexesForUniqueAttributes < ActiveRecord::Migration[5.0]
3
+ def change
4
+ tables = {
5
+ country: [:name, :iso_name],
6
+ refund_reason: [:name],
7
+ reimbursement_type: [:name],
8
+ return_authorization_reason: [:name],
9
+ role: [:name],
10
+ store: [:code]
11
+ }
12
+
13
+ tables.each do |table, columns|
14
+ table_class = "Spree::#{table.to_s.classify}".constantize
15
+ table_name = table_class.table_name
16
+
17
+ columns.each do |column|
18
+ unless index_exists?(table_name, column, unique: true)
19
+ attributes = table_class.unscoped.group(column).having('sum(1) > 1').pluck(column)
20
+ instances = table_class.where(column => [nil, attributes])
21
+
22
+ instances.find_each do |instance|
23
+ column_value = 'Unique String ' + SecureRandom.urlsafe_base64(8).upcase.delete('/+=_-')[0, 8]
24
+ instance.send("#{column}=", column_value)
25
+ instance.save
26
+ end
27
+
28
+ remove_index table_name, column if index_exists?(table_name, column)
29
+ if supports_expression_index?
30
+ add_index table_name, "lower(#{column})", unique: true
31
+ else
32
+ add_index table_name, column, unique: true
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20170329110859)
2
+ class AddIndexOnStockLocationToSpreeCustomerReturns < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_customer_returns, :stock_location_id
5
+ end
6
+ end
@@ -0,0 +1,20 @@
1
+ # This migration comes from spree (originally 20170329113917)
2
+ class AddIndexOnPrototypeToSpreeOptionTypePrototype < ActiveRecord::Migration[5.0]
3
+ def change
4
+ duplicates = Spree::OptionTypePrototype.group(:prototype_id, :option_type_id).having('sum(1) > 1').size
5
+
6
+ duplicates.each do |f|
7
+ prototype_id, option_type_id = f.first
8
+ count = f.last - 1 # we want to leave one record
9
+ otp = Spree::OptionTypePrototype.where(prototype_id: prototype_id, option_type_id: option_type_id).last(count)
10
+ otp.map(&:destroy)
11
+ end
12
+
13
+ if index_exists? :spree_option_type_prototypes, [:prototype_id, :option_type_id]
14
+ remove_index :spree_option_type_prototypes, [:prototype_id, :option_type_id]
15
+ add_index :spree_option_type_prototypes, [:prototype_id, :option_type_id], unique: true, name: 'spree_option_type_prototypes_prototype_id_option_type_id'
16
+ end
17
+
18
+ add_index :spree_option_type_prototypes, :prototype_id
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # This migration comes from spree (originally 20170330082155)
2
+ class AddIndexesToSpreeOptionValueVariant < ActiveRecord::Migration[5.0]
3
+ def change
4
+ duplicates = Spree::OptionValueVariant.group(:variant_id, :option_value_id).having('sum(1) > 1').size
5
+
6
+ duplicates.each do |f|
7
+ variant_id, option_value_id = f.first
8
+ count = f.last - 1 # we want to leave one record
9
+ ov = Spree::OptionValueVariant.where(variant_id: variant_id, option_value_id: option_value_id).last(count)
10
+ ov.map(&:destroy)
11
+ end
12
+
13
+ if index_exists? :spree_option_value_variants, [:variant_id, :option_value_id], name: "index_option_values_variants_on_variant_id_and_option_value_id"
14
+ remove_index :spree_option_value_variants, [:variant_id, :option_value_id]
15
+ add_index :spree_option_value_variants, [:variant_id, :option_value_id], unique: true, name: "index_option_values_variants_on_variant_id_and_option_value_id"
16
+ end
17
+
18
+ add_index :spree_option_value_variants, :variant_id
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20170330132215)
2
+ class AddIndexOnPromotionIdToOrderPromotions < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_order_promotions, :promotion_id
5
+ end
6
+ end
@@ -0,0 +1,21 @@
1
+ # This migration comes from spree (originally 20170331101758)
2
+ class AddIndexesForPropertyPrototype < ActiveRecord::Migration[5.0]
3
+ def change
4
+ duplicates = Spree::PropertyPrototype.group(:prototype_id, :property_id).having('sum(1) > 1').size
5
+
6
+ duplicates.each do |f|
7
+ prototype_id, property_id = f.first
8
+ count = f.last - 1 # we want to leave one record
9
+ prototypes = Spree::PropertyPrototype.where(prototype_id: prototype_id, property_id: property_id).last(count)
10
+ prototypes.map(&:destroy)
11
+ end
12
+
13
+ if index_exists? :spree_property_prototypes, [:prototype_id, :property_id]
14
+ remove_index :spree_property_prototypes, [:prototype_id, :property_id]
15
+ add_index :spree_property_prototypes, [:prototype_id, :property_id], unique: true, name: 'index_property_prototypes_on_prototype_id_and_property_id'
16
+ end
17
+
18
+ add_index :spree_property_prototypes, :prototype_id
19
+ add_index :spree_property_prototypes, :property_id
20
+ end
21
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20170331103334)
2
+ class AddIndexForPrototypeIdToPrototypeTaxons < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_prototype_taxons, :prototype_id
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from spree (originally 20170331110454)
2
+ class AddIndexesToRefunds < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_refunds, :payment_id
5
+ add_index :spree_refunds, :reimbursement_id
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from spree (originally 20170331111757)
2
+ class AddIndexesToReimbursementCredits < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_reimbursement_credits, :reimbursement_id
5
+ add_index :spree_reimbursement_credits, [:creditable_id, :creditable_type], name: 'index_reimbursement_credits_on_creditable_id_and_type'
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from spree (originally 20170331115246)
2
+ class AddIndexesToReturnAuthorizations < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_return_authorizations, :order_id
5
+ add_index :spree_return_authorizations, :stock_location_id
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ # This migration comes from spree (originally 20170331120125)
2
+ class AddIndexesToReturnItems < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_return_items, :return_authorization_id
5
+ add_index :spree_return_items, :inventory_unit_id
6
+ add_index :spree_return_items, :reimbursement_id
7
+ add_index :spree_return_items, :exchange_variant_id
8
+ add_index :spree_return_items, :preferred_reimbursement_type_id
9
+ add_index :spree_return_items, :override_reimbursement_type_id
10
+ end
11
+ end
12
+
@@ -0,0 +1,19 @@
1
+ # This migration comes from spree (originally 20170331121725)
2
+ class AddIndexToRoleUsers < ActiveRecord::Migration[5.0]
3
+ def change
4
+
5
+ duplicates = Spree::RoleUser.group(:role_id, :user_id).having('sum(1) > 1').size
6
+
7
+ duplicates.each do |f|
8
+ role_id, user_id = f.first
9
+ count = f.last - 1 # we want to leave one record
10
+ roles = Spree::RoleUser.where(role_id: role_id, user_id: user_id).last(count)
11
+ roles.map(&:destroy)
12
+ end
13
+
14
+ if index_exists? :spree_role_users, [:role_id, :user_id]
15
+ remove_index :spree_role_users, [:role_id, :user_id]
16
+ add_index :spree_role_users, [:role_id, :user_id], unique: true
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20170331123625)
2
+ class AddIndexToShippingMethodCategories < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_shipping_method_categories, :shipping_category_id
5
+ end
6
+ end
@@ -0,0 +1,21 @@
1
+ # This migration comes from spree (originally 20170331123832)
2
+ class AddIndexToShippingMethodZones < ActiveRecord::Migration[5.0]
3
+ def change
4
+ duplicates = Spree::ShippingMethodZone.group(:shipping_method_id, :zone_id).having('sum(1) > 1').size
5
+
6
+ duplicates.each do |f|
7
+ shipping_method_id, zone_id = f.first
8
+ count = f.last - 1 # we want to leave one record
9
+ zones = Spree::ShippingMethodZone.where(shipping_method_id: shipping_method_id, zone_id: zone_id).last(count)
10
+ zones.map(&:destroy)
11
+ end
12
+
13
+ if index_exists? :spree_shipping_method_zones, [:shipping_method_id, :zone_id]
14
+ remove_index :spree_shipping_method_zones, [:shipping_method_id, :zone_id]
15
+ add_index :spree_shipping_method_zones, [:shipping_method_id, :zone_id], unique: true
16
+ end
17
+
18
+ add_index :spree_shipping_method_zones, :zone_id
19
+ add_index :spree_shipping_method_zones, :shipping_method_id
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from spree (originally 20170331124251)
2
+ class AddIndexToSpreeShippingRates < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_shipping_rates, :shipment_id
5
+ add_index :spree_shipping_rates, :shipping_method_id
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20170331124513)
2
+ class AddIndexToSpreeStockItems < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_stock_items, :stock_location_id
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20170331124924)
2
+ class AddIndexToSpreeStockMovement < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_index :spree_stock_movements, [:originator_id, :originator_type], name: 'index_stock_movements_on_originator_id_and_originator_type'
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ # This migration comes from spree (originally 20170413211707)
2
+ class ChangeIndexesOnFriendlyIdSlugs < ActiveRecord::Migration[5.0]
3
+ def change
4
+ # Updating indexes to reflect changes in friendly_id v5.2
5
+ # See: https://github.com/norman/friendly_id/pull/694/commits/9f107f07ec9d2a58bda5a712b6e79a8d8013e0ab
6
+ remove_index :friendly_id_slugs, [:slug, :sluggable_type]
7
+ remove_index :friendly_id_slugs, [:slug, :sluggable_type, :scope]
8
+ add_index :friendly_id_slugs, [:slug, :sluggable_type], length: { name: 100, slug: 20, sluggable_type: 20 }
9
+ add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], length: { name: 100, slug: 20, sluggable_type: 20, scope: 20 }, unique: true
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20170722102643)
2
+ class AddAnalyticsKindToSpreeTrackers < ActiveRecord::Migration[5.1]
3
+ def change
4
+ add_column :spree_trackers, :kind, :integer, default: 0, null: false, index: true
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from spree (originally 20170727103056)
2
+ class RenameTrackerKindField < ActiveRecord::Migration[5.1]
3
+ def change
4
+ rename_column :spree_trackers, :kind, :engine
5
+ end
6
+ end