update migration versions

This commit is contained in:
Andy Brett
2021-04-09 10:56:56 -07:00
parent 0aad2e0bea
commit d1f978a73e
68 changed files with 68 additions and 68 deletions

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
class OldMigrationsRemoved < ActiveRecord::Migration
class OldMigrationsRemoved < ActiveRecord::Migration[4.2]
def up
raise StandardError, <<-MESSAGE

View File

@@ -1,4 +1,4 @@
class DeleteAccountInvoicesPreferences < ActiveRecord::Migration
class DeleteAccountInvoicesPreferences < ActiveRecord::Migration[4.2]
def up
Spree::Preference
.where( key: ['spree/app_configuration/accounts_distributor_id',

View File

@@ -1,4 +1,4 @@
class DeleteAccountInvoicesAdjustments < ActiveRecord::Migration
class DeleteAccountInvoicesAdjustments < ActiveRecord::Migration[4.2]
def up
Spree::Adjustment
.where(source_type: 'BillablePeriod')

View File

@@ -1,4 +1,4 @@
class DropEnterpriseShopTrialStartDate < ActiveRecord::Migration
class DropEnterpriseShopTrialStartDate < ActiveRecord::Migration[4.2]
def up
remove_column :enterprises, :shop_trial_start_date
end

View File

@@ -1,4 +1,4 @@
class DropProductDistributions < ActiveRecord::Migration
class DropProductDistributions < ActiveRecord::Migration[4.2]
def up
drop_table :product_distributions
end

View File

@@ -1,4 +1,4 @@
class SetDefaultStockLocationOnShipments < ActiveRecord::Migration
class SetDefaultStockLocationOnShipments < ActiveRecord::Migration[4.2]
def up
if Spree::Shipment.where('stock_location_id IS NULL').count > 0
location = DefaultStockLocation.find_or_create

View File

@@ -1,4 +1,4 @@
class AddShippingCategoryToShippingMethodsAndProducts < ActiveRecord::Migration
class AddShippingCategoryToShippingMethodsAndProducts < ActiveRecord::Migration[4.2]
def up
# This is different from the equivalent Spree migration
# Here we are creating the default shipping category even if there are already shipping categories

View File

@@ -1,4 +1,4 @@
class DropAccountInvoicesAndBillablePeriods < ActiveRecord::Migration
class DropAccountInvoicesAndBillablePeriods < ActiveRecord::Migration[4.2]
def up
drop_table :billable_periods
drop_table :account_invoices

View File

@@ -1,4 +1,4 @@
class DeleteObsoletePendingJobs < ActiveRecord::Migration
class DeleteObsoletePendingJobs < ActiveRecord::Migration[4.2]
def up
Delayed::Job.all.each do |job|
job.delete if job.name == "FinalizeAccountInvoices" ||

View File

@@ -1,4 +1,4 @@
class AddDeletedAtToSpreeStockItems < ActiveRecord::Migration
class AddDeletedAtToSpreeStockItems < ActiveRecord::Migration[4.2]
def up
add_column :spree_stock_items, :deleted_at, :datetime
end

View File

@@ -1,4 +1,4 @@
class MigrateVariantsOnDemandToStockItemsBackorderable < ActiveRecord::Migration
class MigrateVariantsOnDemandToStockItemsBackorderable < ActiveRecord::Migration[4.2]
def up
# We use SQL directly here to avoid going through VariantStock.on_demand and VariantStock.on_demand=
sql = "update spree_stock_items set backorderable = (select on_demand from spree_variants where spree_variants.id = spree_stock_items.variant_id)"

View File

@@ -1,4 +1,4 @@
class RemoveFieldNameFromExchange < ActiveRecord::Migration
class RemoveFieldNameFromExchange < ActiveRecord::Migration[4.2]
def up
remove_column :exchanges, :payment_enterprise_id
end

View File

@@ -1,4 +1,4 @@
class UpdateStockLocationsBackorderableDefault < ActiveRecord::Migration
class UpdateStockLocationsBackorderableDefault < ActiveRecord::Migration[4.2]
def change
Spree::StockLocation.update_all(backorderable_default: false)
end

View File

@@ -1,4 +1,4 @@
class ConvertStringFieldsToText < ActiveRecord::Migration
class ConvertStringFieldsToText < ActiveRecord::Migration[4.2]
def up
change_column :enterprises, :description, :text
change_column :enterprises, :pickup_times, :text

View File

@@ -1,4 +1,4 @@
class AddDeletedAtToSpreePrices < ActiveRecord::Migration
class AddDeletedAtToSpreePrices < ActiveRecord::Migration[4.2]
def change
add_column :spree_prices, :deleted_at, :datetime
end

View File

@@ -1,4 +1,4 @@
class ResetNegativeStockLevels < ActiveRecord::Migration
class ResetNegativeStockLevels < ActiveRecord::Migration[4.2]
def up
# Reset stock to zero for all on_demand variants that have negative stock
execute "UPDATE spree_stock_items SET count_on_hand = '0' WHERE count_on_hand < 0 AND backorderable IS TRUE"

View File

@@ -1,4 +1,4 @@
class RemoveBrokenVariantsFromCarts < ActiveRecord::Migration
class RemoveBrokenVariantsFromCarts < ActiveRecord::Migration[4.2]
def up
# Removes line_items from open carts where the variant has a hard-deleted price

View File

@@ -1,4 +1,4 @@
class SetBackorderedInventoryToOnHand < ActiveRecord::Migration
class SetBackorderedInventoryToOnHand < ActiveRecord::Migration[4.2]
def up
execute("UPDATE spree_inventory_units SET state = 'on_hand' WHERE state = 'backordered'")
end

View File

@@ -1,4 +1,4 @@
class ReplaceHardDeletedPrices < ActiveRecord::Migration
class ReplaceHardDeletedPrices < ActiveRecord::Migration[4.2]
def up
ActiveRecord::Base.connection.execute(
"INSERT into spree_prices (variant_id, amount, currency, deleted_at)

View File

@@ -1,4 +1,4 @@
class AddLongCompoundIndexOnSpreeOrders < ActiveRecord::Migration
class AddLongCompoundIndexOnSpreeOrders < ActiveRecord::Migration[4.2]
def change
add_index(
:spree_orders,

View File

@@ -1,4 +1,4 @@
class DropCompletedAtIndexOnSpreeOrders < ActiveRecord::Migration
class DropCompletedAtIndexOnSpreeOrders < ActiveRecord::Migration[4.2]
def change
remove_index :spree_orders, :completed_at
end

View File

@@ -1,4 +1,4 @@
class RemoveAllMasterVariantsFromExchanges < ActiveRecord::Migration
class RemoveAllMasterVariantsFromExchanges < ActiveRecord::Migration[4.2]
def up
# 1. We add standard variants of the products of "lonely masters" into the Exchanges where the master variants are lonely
match_master_variants

View File

@@ -1,4 +1,4 @@
class DropOrdersShippingMethodId < ActiveRecord::Migration
class DropOrdersShippingMethodId < ActiveRecord::Migration[4.2]
def up
remove_column :spree_orders, :shipping_method_id
end

View File

@@ -1,4 +1,4 @@
class DropPrototypesTables < ActiveRecord::Migration
class DropPrototypesTables < ActiveRecord::Migration[4.2]
def up
drop_table :spree_option_types_prototypes
drop_table :spree_properties_prototypes

View File

@@ -1,4 +1,4 @@
class AddIndexesToSpreeOrders < ActiveRecord::Migration
class AddIndexesToSpreeOrders < ActiveRecord::Migration[4.2]
def change
add_index :spree_orders, :order_cycle_id
add_index :spree_orders, :distributor_id

View File

@@ -1,4 +1,4 @@
class AddCustomDataToVersions < ActiveRecord::Migration
class AddCustomDataToVersions < ActiveRecord::Migration[4.2]
def change
add_column :versions, :custom_data, :string
end

View File

@@ -1,4 +1,4 @@
class ChangeCvvResponseMessageToTextInSpreePayments < ActiveRecord::Migration
class ChangeCvvResponseMessageToTextInSpreePayments < ActiveRecord::Migration[4.2]
def up
change_column :spree_payments, :cvv_response_message, :text
end

View File

@@ -1,4 +1,4 @@
class ChangeVersionsCustomDataToText < ActiveRecord::Migration
class ChangeVersionsCustomDataToText < ActiveRecord::Migration[4.2]
def up
change_column :versions, :custom_data, :text
end

View File

@@ -1,4 +1,4 @@
class AddUserIdIndexToSpreeOrders < ActiveRecord::Migration
class AddUserIdIndexToSpreeOrders < ActiveRecord::Migration[4.2]
def change
add_index :spree_orders, :user_id
end

View File

@@ -1,4 +1,4 @@
class AddSupplierIdIndexToSpreeProducts < ActiveRecord::Migration
class AddSupplierIdIndexToSpreeProducts < ActiveRecord::Migration[4.2]
def change
add_index :spree_products, :supplier_id
end

View File

@@ -1,4 +1,4 @@
class DropTrackersTable < ActiveRecord::Migration
class DropTrackersTable < ActiveRecord::Migration[4.2]
def up
drop_table :spree_trackers
end

View File

@@ -1,4 +1,4 @@
class RemoveGaCookiesPreference < ActiveRecord::Migration
class RemoveGaCookiesPreference < ActiveRecord::Migration[4.2]
class Spree::Preference < ActiveRecord::Base; end
def up

View File

@@ -1,4 +1,4 @@
class IncreaseCharactersOfLocaleInSpreeUsers < ActiveRecord::Migration
class IncreaseCharactersOfLocaleInSpreeUsers < ActiveRecord::Migration[4.2]
def up
change_column :spree_users, :locale, :string, limit: 6
end

View File

@@ -1,4 +1,4 @@
class DropMailMethods < ActiveRecord::Migration
class DropMailMethods < ActiveRecord::Migration[4.2]
def up
drop_table :spree_mail_methods

View File

@@ -1,4 +1,4 @@
class AddTimestampsToOrderCycleSchedules < ActiveRecord::Migration
class AddTimestampsToOrderCycleSchedules < ActiveRecord::Migration[4.2]
def change
change_table :order_cycle_schedules do |t|
t.timestamps

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
class ConvertFrontendShippingMethodToBoth < ActiveRecord::Migration
class ConvertFrontendShippingMethodToBoth < ActiveRecord::Migration[4.2]
def up
# The display_on value front_end is not working
# (it's not being used in the back office to ignore shipping methods marked as front_end)

View File

@@ -1,4 +1,4 @@
class AddLockVersionToStockItems < ActiveRecord::Migration
class AddLockVersionToStockItems < ActiveRecord::Migration[4.2]
def change
add_column :spree_stock_items, :lock_version, :integer, default: 0
end

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
class ResetNegativeNonbackorderableCountOnHandInStockItems < ActiveRecord::Migration
class ResetNegativeNonbackorderableCountOnHandInStockItems < ActiveRecord::Migration[4.2]
module Spree
class StockItem < ActiveRecord::Base
self.table_name = "spree_stock_items"

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
class MoveAllCalculatorsOutsideTheSpreeNamespace < ActiveRecord::Migration
class MoveAllCalculatorsOutsideTheSpreeNamespace < ActiveRecord::Migration[4.2]
def up
convert_calculator("DefaultTax")
convert_calculator("FlatPercentItemTotal")

View File

@@ -1,4 +1,4 @@
class FixPreferencesKeys < ActiveRecord::Migration
class FixPreferencesKeys < ActiveRecord::Migration[4.2]
def up
unmigrated_preferences = Spree::Preference.exists?(['key NOT LIKE ?', '/%'])
return unless unmigrated_preferences

View File

@@ -1,4 +1,4 @@
class MakeTimestampsNullable < ActiveRecord::Migration
class MakeTimestampsNullable < ActiveRecord::Migration[4.2]
def up
change_column_null :customers, :created_at, true
change_column_null :customers, :updated_at, true

View File

@@ -1,4 +1,4 @@
class RequireTimestamps < ActiveRecord::Migration
class RequireTimestamps < ActiveRecord::Migration[4.2]
def up
current_time = Time.zone.now

View File

@@ -1,4 +1,4 @@
class AddStatefulIdIndexToStateChanges < ActiveRecord::Migration
class AddStatefulIdIndexToStateChanges < ActiveRecord::Migration[4.2]
def change
add_index :spree_state_changes, :stateful_id
end

View File

@@ -1,6 +1,6 @@
# As we moved the calculators outside the Spree namespace in migration MoveAllCalculatorsOutsideTheSpreeNamespace
# We need to move their preferences too (currency, value, etc), otherwise they are not used
class MoveCalculatorsPreferencesOutsideSpreeNamespace < ActiveRecord::Migration
class MoveCalculatorsPreferencesOutsideSpreeNamespace < ActiveRecord::Migration[4.2]
def up
replace_preferences_key("/spree/calculator", "/calculator")
end

View File

@@ -1,4 +1,4 @@
class AddTermsAndConditionsToEnterprises < ActiveRecord::Migration
class AddTermsAndConditionsToEnterprises < ActiveRecord::Migration[4.2]
def change
add_attachment :enterprises, :terms_and_conditions
end

View File

@@ -1,4 +1,4 @@
class AddCustomerTermsAndConditionsAccepted < ActiveRecord::Migration
class AddCustomerTermsAndConditionsAccepted < ActiveRecord::Migration[4.2]
def change
add_column :customers, :terms_and_conditions_accepted_at, :datetime
end

View File

@@ -1,4 +1,4 @@
class UpdateWeightCalculators < ActiveRecord::Migration
class UpdateWeightCalculators < ActiveRecord::Migration[4.2]
def change
Spree::Calculator.connection.execute(
"UPDATE spree_preferences SET key = replace( key, 'per_kg', 'per_unit') WHERE key ilike '/calculator/weight/per_kg/%'"

View File

@@ -1,6 +1,6 @@
# For some unkonwn reason, after removing Spree as a dependency, some spree calculators appeared on live DBs
# Here we repeat the migration
class RepeatMoveAllCalculatorsOutsideTheSpreeNamespace < ActiveRecord::Migration
class RepeatMoveAllCalculatorsOutsideTheSpreeNamespace < ActiveRecord::Migration[4.2]
def up
convert_calculator("DefaultTax")
convert_calculator("FlatPercentItemTotal")

View File

@@ -1,6 +1,6 @@
# For some unkonwn reason, after removing Spree as a dependency, some spree calculators appeared on live DBs
# Here we repeat the migration
class RepeatMoveCalculatorsPreferencesOutsideSpreeNamespace < ActiveRecord::Migration
class RepeatMoveCalculatorsPreferencesOutsideSpreeNamespace < ActiveRecord::Migration[4.2]
def up
replace_preferences_key("/spree/calculator", "/calculator")
end

View File

@@ -1,4 +1,4 @@
class AddOrderToAdjustments < ActiveRecord::Migration
class AddOrderToAdjustments < ActiveRecord::Migration[4.2]
class Spree::Adjustment < ActiveRecord::Base
belongs_to :adjustable, polymorphic: true
belongs_to :order, class_name: "Spree::Order"

View File

@@ -1,4 +1,4 @@
class AddIncludedToAdjustments < ActiveRecord::Migration
class AddIncludedToAdjustments < ActiveRecord::Migration[4.2]
class Spree::TaxRate < ActiveRecord::Base; end
class Spree::Adjustment < ActiveRecord::Base

View File

@@ -1,4 +1,4 @@
class AddDeletedAtToEnterpriseFee < ActiveRecord::Migration
class AddDeletedAtToEnterpriseFee < ActiveRecord::Migration[4.2]
def change
add_column :enterprise_fees, :deleted_at, :datetime
end

View File

@@ -1,4 +1,4 @@
class AddTaxTotalsToOrder < ActiveRecord::Migration
class AddTaxTotalsToOrder < ActiveRecord::Migration[4.2]
def up
add_column :spree_orders, :included_tax_total, :decimal,
precision: 10, scale: 2, null: false, default: 0.0

View File

@@ -1,4 +1,4 @@
class RemoveEnableMailDeliveryPreference < ActiveRecord::Migration
class RemoveEnableMailDeliveryPreference < ActiveRecord::Migration[4.2]
def up
Spree::Preference.delete_all("key ilike '%enable_mail_delivery%'")
end

View File

@@ -1,4 +1,4 @@
class PopulateOrderTaxTotals < ActiveRecord::Migration
class PopulateOrderTaxTotals < ActiveRecord::Migration[4.2]
def up
# Updates new order tax total fields (additional_tax_total and included_tax_total).
# Sums the relevant values from associated adjustments and updates the two columns.

View File

@@ -1,4 +1,4 @@
class AddCascadingDeletes < ActiveRecord::Migration
class AddCascadingDeletes < ActiveRecord::Migration[4.2]
def change
# Updates foreign key definitions between orders, shipments, and inventory_units
# to allow for cascading deletes at database level. If an order is intentionally

View File

@@ -1,4 +1,4 @@
class IncreasePrecionOnCurrencyFields < ActiveRecord::Migration
class IncreasePrecionOnCurrencyFields < ActiveRecord::Migration[4.2]
def up
change_column :spree_line_items, :price, :decimal, precision: 10, scale: 2
change_column :spree_line_items, :cost_price, :decimal, precision: 10, scale: 2

View File

@@ -1,4 +1,4 @@
class RenameMigsPaymentMethodsToCheck < ActiveRecord::Migration
class RenameMigsPaymentMethodsToCheck < ActiveRecord::Migration[4.2]
def change
Spree::PaymentMethod
.where(type: "Spree::Gateway::Migs")

View File

@@ -1,4 +1,4 @@
class RenamePinPaymentMethodsToCheck < ActiveRecord::Migration
class RenamePinPaymentMethodsToCheck < ActiveRecord::Migration[4.2]
def change
Spree::PaymentMethod
.where(type: "Spree::Gateway::Pin")

View File

@@ -1,4 +1,4 @@
class AddTaxCategoryIdToShippingMethods < ActiveRecord::Migration
class AddTaxCategoryIdToShippingMethods < ActiveRecord::Migration[4.2]
def change
add_column :spree_shipping_methods, :tax_category_id, :integer
end

View File

@@ -1,4 +1,4 @@
class SetDefaultShipmentCost < ActiveRecord::Migration
class SetDefaultShipmentCost < ActiveRecord::Migration[4.2]
def up
change_column_null :spree_shipments, :cost, false, 0.0
change_column_default :spree_shipments, :cost, 0.0

View File

@@ -1,4 +1,4 @@
class AddTaxTotalsToShipment < ActiveRecord::Migration
class AddTaxTotalsToShipment < ActiveRecord::Migration[4.2]
def up
add_column :spree_shipments, :included_tax_total, :decimal,
precision: 10, scale: 2, null: false, default: 0.0

View File

@@ -1,4 +1,4 @@
class AddAdjustmentTotalToShipment < ActiveRecord::Migration
class AddAdjustmentTotalToShipment < ActiveRecord::Migration[4.2]
def up
add_column :spree_shipments, :adjustment_total, :decimal,
precision: 10, scale: 2, null: false, default: 0.0

View File

@@ -1,4 +1,4 @@
class MigrateShipmentFeesToShipments < ActiveRecord::Migration
class MigrateShipmentFeesToShipments < ActiveRecord::Migration[4.2]
class Spree::Adjustment < ActiveRecord::Base
belongs_to :originator, polymorphic: true
end

View File

@@ -1,4 +1,4 @@
class RemoveCostPriceFromVariantAndLineItem < ActiveRecord::Migration
class RemoveCostPriceFromVariantAndLineItem < ActiveRecord::Migration[4.2]
def up
remove_column :spree_variants, :cost_price
remove_column :spree_line_items, :cost_price

View File

@@ -1,4 +1,4 @@
class MigrateShippingTaxes < ActiveRecord::Migration
class MigrateShippingTaxes < ActiveRecord::Migration[4.2]
class Spree::Preference < ActiveRecord::Base; end
class Spree::TaxCategory < ActiveRecord::Base
has_many :tax_rates, class_name: "Spree::TaxRate", inverse_of: :tax_category

View File

@@ -1,4 +1,4 @@
class MigratePaymentFeesToPayments < ActiveRecord::Migration
class MigratePaymentFeesToPayments < ActiveRecord::Migration[4.2]
class Spree::Adjustment < ActiveRecord::Base
belongs_to :originator, polymorphic: true
end

View File

@@ -1,4 +1,4 @@
class MigrateLineItemFees < ActiveRecord::Migration
class MigrateLineItemFees < ActiveRecord::Migration[4.2]
class Spree::Adjustment < ActiveRecord::Base
belongs_to :originator, polymorphic: true
belongs_to :source, polymorphic: true