Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix migrations for Rails 5.2

Damian Legawiec8d6e06902678
diff --git a/core/db/migrate/20191016134113_add_deafult_value_for_store_default_currency.rb b/core/db/migrate/20191016134113_add_deafult_value_for_store_default_currency.rb
index ddd62f9d5b..f5066c4389 100644
--- a/core/db/migrate/20191016134113_add_deafult_value_for_store_default_currency.rb
+++ b/core/db/migrate/20191016134113_add_deafult_value_for_store_default_currency.rb
@@ -1,4 +1,4 @@
-class AddDeafultValueForStoreDefaultCurrency < ActiveRecord::Migration[6.0]
+class AddDeafultValueForStoreDefaultCurrency < ActiveRecord::Migration[5.2]
def change
Spree::Store.where(default_currency: nil).update_all(default_currency: Spree::Config[:currency])
end
diff --git a/core/db/migrate/20191017121054_add_supported_currencies_to_store.rb b/core/db/migrate/20191017121054_add_supported_currencies_to_store.rb
index 6a64d5cf1d..f9ecc1a575 100644
--- a/core/db/migrate/20191017121054_add_supported_currencies_to_store.rb
+++ b/core/db/migrate/20191017121054_add_supported_currencies_to_store.rb
@@ -1,4 +1,4 @@
-class AddSupportedCurrenciesToStore < ActiveRecord::Migration[6.0]
+class AddSupportedCurrenciesToStore < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_stores, :supported_currencies)
add_column :spree_stores, :supported_currencies, :string
diff --git a/core/db/migrate/20200102141311_add_social_to_spree_stores.rb b/core/db/migrate/20200102141311_add_social_to_spree_stores.rb
index f450d7320c..bb6f149bda 100644
--- a/core/db/migrate/20200102141311_add_social_to_spree_stores.rb
+++ b/core/db/migrate/20200102141311_add_social_to_spree_stores.rb
@@ -1,4 +1,4 @@
-class AddSocialToSpreeStores < ActiveRecord::Migration[6.0]
+class AddSocialToSpreeStores < ActiveRecord::Migration[5.2]
def change
add_column :spree_stores, :facebook, :string
add_column :spree_stores, :twitter, :string
diff --git a/core/db/migrate/20200212144523_add_hide_from_nav_to_taxons.rb b/core/db/migrate/20200212144523_add_hide_from_nav_to_taxons.rb
index bc7e0aac3a..4c9f818eb2 100644
--- a/core/db/migrate/20200212144523_add_hide_from_nav_to_taxons.rb
+++ b/core/db/migrate/20200212144523_add_hide_from_nav_to_taxons.rb
@@ -1,4 +1,4 @@
-class AddHideFromNavToTaxons < ActiveRecord::Migration[6.0]
+class AddHideFromNavToTaxons < ActiveRecord::Migration[5.2]
def change
add_column :spree_taxons, :hide_from_nav, :boolean, default: false, index: true
end
diff --git a/core/db/migrate/20200308210757_add_default_locale_to_spree_store.rb b/core/db/migrate/20200308210757_add_default_locale_to_spree_store.rb
index 6786158f36..14b2c2aecb 100644
--- a/core/db/migrate/20200308210757_add_default_locale_to_spree_store.rb
+++ b/core/db/migrate/20200308210757_add_default_locale_to_spree_store.rb
@@ -1,4 +1,4 @@
-class AddDefaultLocaleToSpreeStore < ActiveRecord::Migration[6.0]
+class AddDefaultLocaleToSpreeStore < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_stores, :default_locale)
add_column :spree_stores, :default_locale, :string
diff --git a/core/db/migrate/20200310145140_add_customer_support_email_to_spree_store.rb b/core/db/migrate/20200310145140_add_customer_support_email_to_spree_store.rb
index 418ada3efe..4d0abfd8ee 100644
--- a/core/db/migrate/20200310145140_add_customer_support_email_to_spree_store.rb
+++ b/core/db/migrate/20200310145140_add_customer_support_email_to_spree_store.rb
@@ -1,4 +1,4 @@
-class AddCustomerSupportEmailToSpreeStore < ActiveRecord::Migration[6.0]
+class AddCustomerSupportEmailToSpreeStore < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_stores, :customer_support_email)
add_column :spree_stores, :customer_support_email, :string
diff --git a/core/db/migrate/20200421095017_add_compare_at_amount_to_spree_prices.rb b/core/db/migrate/20200421095017_add_compare_at_amount_to_spree_prices.rb
index 085e820b68..de98207ac6 100644
--- a/core/db/migrate/20200421095017_add_compare_at_amount_to_spree_prices.rb
+++ b/core/db/migrate/20200421095017_add_compare_at_amount_to_spree_prices.rb
@@ -1,4 +1,4 @@
-class AddCompareAtAmountToSpreePrices < ActiveRecord::Migration[6.0]
+class AddCompareAtAmountToSpreePrices < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_prices, :compare_at_amount)
add_column :spree_prices, :compare_at_amount, :decimal, precision: 10, scale: 2
diff --git a/core/db/migrate/20200423123001_add_default_country_id_to_spree_store.rb b/core/db/migrate/20200423123001_add_default_country_id_to_spree_store.rb
index 453b29a698..fa7139a6be 100644
--- a/core/db/migrate/20200423123001_add_default_country_id_to_spree_store.rb
+++ b/core/db/migrate/20200423123001_add_default_country_id_to_spree_store.rb
@@ -1,4 +1,4 @@
-class AddDefaultCountryIdToSpreeStore < ActiveRecord::Migration[6.0]
+class AddDefaultCountryIdToSpreeStore < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_stores, :default_country_id)
add_column :spree_stores, :default_country_id, :integer
diff --git a/core/db/migrate/20200430072209_add_footer_fields_to_spree_stores.rb b/core/db/migrate/20200430072209_add_footer_fields_to_spree_stores.rb
index 286b2f3d36..0f0238d39b 100644
--- a/core/db/migrate/20200430072209_add_footer_fields_to_spree_stores.rb
+++ b/core/db/migrate/20200430072209_add_footer_fields_to_spree_stores.rb
@@ -1,4 +1,4 @@
-class AddFooterFieldsToSpreeStores < ActiveRecord::Migration[6.0]
+class AddFooterFieldsToSpreeStores < ActiveRecord::Migration[5.2]
def change
add_column :spree_stores, :description, :text unless column_exists?(:spree_stores, :description)
add_column :spree_stores, :address, :text unless column_exists?(:spree_stores, :address)
diff --git a/core/db/migrate/20200513154939_add_show_property_to_spree_product_properties.rb b/core/db/migrate/20200513154939_add_show_property_to_spree_product_properties.rb
index 3b39df8b8d..aab8f35999 100644
--- a/core/db/migrate/20200513154939_add_show_property_to_spree_product_properties.rb
+++ b/core/db/migrate/20200513154939_add_show_property_to_spree_product_properties.rb
@@ -1,4 +1,4 @@
-class AddShowPropertyToSpreeProductProperties < ActiveRecord::Migration[6.0]
+class AddShowPropertyToSpreeProductProperties < ActiveRecord::Migration[5.2]
def change
add_column :spree_product_properties, :show_property, :boolean, default: true unless column_exists?(:spree_product_properties, :show_property)
end
diff --git a/core/db/migrate/20200607161221_add_store_owner_order_notification_delivered_to_spree_orders.rb b/core/db/migrate/20200607161221_add_store_owner_order_notification_delivered_to_spree_orders.rb
index c1c7342e50..655b533742 100644
--- a/core/db/migrate/20200607161221_add_store_owner_order_notification_delivered_to_spree_orders.rb
+++ b/core/db/migrate/20200607161221_add_store_owner_order_notification_delivered_to_spree_orders.rb
@@ -1,4 +1,4 @@
-class AddStoreOwnerOrderNotificationDeliveredToSpreeOrders < ActiveRecord::Migration[6.0]
+class AddStoreOwnerOrderNotificationDeliveredToSpreeOrders < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_orders, :store_owner_notification_delivered)
add_column :spree_orders, :store_owner_notification_delivered, :boolean
diff --git a/core/db/migrate/20200607161222_add_new_order_notifications_email_to_spree_stores.rb b/core/db/migrate/20200607161222_add_new_order_notifications_email_to_spree_stores.rb
index 2271abd258..2d71f9625e 100644
--- a/core/db/migrate/20200607161222_add_new_order_notifications_email_to_spree_stores.rb
+++ b/core/db/migrate/20200607161222_add_new_order_notifications_email_to_spree_stores.rb
@@ -1,4 +1,4 @@
-class AddNewOrderNotificationsEmailToSpreeStores < ActiveRecord::Migration[6.0]
+class AddNewOrderNotificationsEmailToSpreeStores < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_stores, :new_order_notifications_email)
add_column :spree_stores, :new_order_notifications_email, :string
diff --git a/core/db/migrate/20200610113542_add_label_to_spree_addresses.rb b/core/db/migrate/20200610113542_add_label_to_spree_addresses.rb
index d41c3bd776..5b2a6c07dd 100644
--- a/core/db/migrate/20200610113542_add_label_to_spree_addresses.rb
+++ b/core/db/migrate/20200610113542_add_label_to_spree_addresses.rb
@@ -1,4 +1,4 @@
-class AddLabelToSpreeAddresses < ActiveRecord::Migration[6.0]
+class AddLabelToSpreeAddresses < ActiveRecord::Migration[5.2]
def change
add_column :spree_addresses, :label, :string unless column_exists?(:spree_addresses, :label)
end
diff --git a/core/db/migrate/20200826075557_add_unique_index_on_taxon_id_and_product_id_to_spree_products_taxons.rb b/core/db/migrate/20200826075557_add_unique_index_on_taxon_id_and_product_id_to_spree_products_taxons.rb
index e0da18710e..4e71ece82e 100644
--- a/core/db/migrate/20200826075557_add_unique_index_on_taxon_id_and_product_id_to_spree_products_taxons.rb
+++ b/core/db/migrate/20200826075557_add_unique_index_on_taxon_id_and_product_id_to_spree_products_taxons.rb
@@ -1,4 +1,4 @@
-class AddUniqueIndexOnTaxonIdAndProductIdToSpreeProductsTaxons < ActiveRecord::Migration[6.0]
+class AddUniqueIndexOnTaxonIdAndProductIdToSpreeProductsTaxons < ActiveRecord::Migration[5.2]
def change
add_index :spree_products_taxons, [:product_id, :taxon_id], unique: true unless index_exists? :spree_products_taxons, [:product_id, :taxon_id]
end
diff --git a/core/db/migrate/20201006110150_add_checkout_zone_field_to_store.rb b/core/db/migrate/20201006110150_add_checkout_zone_field_to_store.rb
index aea8ff9df1..3c005377fe 100644
--- a/core/db/migrate/20201006110150_add_checkout_zone_field_to_store.rb
+++ b/core/db/migrate/20201006110150_add_checkout_zone_field_to_store.rb
@@ -1,4 +1,4 @@
-class AddCheckoutZoneFieldToStore < ActiveRecord::Migration[6.0]
+class AddCheckoutZoneFieldToStore < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_stores, :checkout_zone_id)
add_column :spree_stores, :checkout_zone_id, :integer
diff --git a/core/db/migrate/20201012091259_add_filterable_column_to_spree_option_types.rb b/core/db/migrate/20201012091259_add_filterable_column_to_spree_option_types.rb
index 7748690eee..7d3f7eba5f 100644
--- a/core/db/migrate/20201012091259_add_filterable_column_to_spree_option_types.rb
+++ b/core/db/migrate/20201012091259_add_filterable_column_to_spree_option_types.rb
@@ -1,4 +1,4 @@
-class AddFilterableColumnToSpreeOptionTypes < ActiveRecord::Migration[6.0]
+class AddFilterableColumnToSpreeOptionTypes < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_option_types, :filterable)
add_column :spree_option_types, :filterable, :boolean, default: true, null: false
diff --git a/core/db/migrate/20201013084504_add_seo_robots_to_spree_stores.rb b/core/db/migrate/20201013084504_add_seo_robots_to_spree_stores.rb
index 65bb7a1c36..6de836f3bc 100644
--- a/core/db/migrate/20201013084504_add_seo_robots_to_spree_stores.rb
+++ b/core/db/migrate/20201013084504_add_seo_robots_to_spree_stores.rb
@@ -1,4 +1,4 @@
-class AddSeoRobotsToSpreeStores < ActiveRecord::Migration[6.0]
+class AddSeoRobotsToSpreeStores < ActiveRecord::Migration[5.2]
def change
add_column :spree_stores, :seo_robots, :string unless column_exists?(:spree_stores, :seo_robots)
end
diff --git a/core/db/migrate/20201023152810_add_filterable_to_spree_properties.rb b/core/db/migrate/20201023152810_add_filterable_to_spree_properties.rb
index e09ede30ae..7de175b979 100644
--- a/core/db/migrate/20201023152810_add_filterable_to_spree_properties.rb
+++ b/core/db/migrate/20201023152810_add_filterable_to_spree_properties.rb
@@ -1,4 +1,4 @@
-class AddFilterableToSpreeProperties < ActiveRecord::Migration[6.0]
+class AddFilterableToSpreeProperties < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_properties, :filterable)
add_column :spree_properties, :filterable, :boolean, default: false, null: false
diff --git a/core/db/migrate/20201127084048_add_default_country_kind_to_spree_zones.rb b/core/db/migrate/20201127084048_add_default_country_kind_to_spree_zones.rb
index ee33416787..3dfc820ac8 100644
--- a/core/db/migrate/20201127084048_add_default_country_kind_to_spree_zones.rb
+++ b/core/db/migrate/20201127084048_add_default_country_kind_to_spree_zones.rb
@@ -1,4 +1,4 @@
-class AddDefaultCountryKindToSpreeZones < ActiveRecord::Migration[6.0]
+class AddDefaultCountryKindToSpreeZones < ActiveRecord::Migration[5.2]
def change
change_column_default(:spree_zones, :kind, :state)
end
diff --git a/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb b/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb
index 46f0478b40..1d67dcf1af 100644
--- a/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb
+++ b/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb
@@ -1,4 +1,4 @@
-class RemoveContactEmailFromSpreeStores < ActiveRecord::Migration[6.0]
+class RemoveContactEmailFromSpreeStores < ActiveRecord::Migration[5.2]
def change
remove_column :spree_stores, :contact_email
end
diff --git a/core/db/migrate/20210114182625_create_spree_payment_methods_stores.rb b/core/db/migrate/20210114182625_create_spree_payment_methods_stores.rb
index 578e28d65d..8dcc9bc381 100644
--- a/core/db/migrate/20210114182625_create_spree_payment_methods_stores.rb
+++ b/core/db/migrate/20210114182625_create_spree_payment_methods_stores.rb
@@ -1,4 +1,4 @@
-class CreateSpreePaymentMethodsStores < ActiveRecord::Migration[6.0]
+class CreateSpreePaymentMethodsStores < ActiveRecord::Migration[5.2]
def change
create_table :spree_payment_methods_stores, id: false do |t|
t.belongs_to :payment_method
diff --git a/core/db/migrate/20210114220232_migrate_data_payment_methods_stores.rb b/core/db/migrate/20210114220232_migrate_data_payment_methods_stores.rb
index e231b4315d..6f2fec6aae 100644
--- a/core/db/migrate/20210114220232_migrate_data_payment_methods_stores.rb
+++ b/core/db/migrate/20210114220232_migrate_data_payment_methods_stores.rb
@@ -1,4 +1,4 @@
-class MigrateDataPaymentMethodsStores < ActiveRecord::Migration[6.0]
+class MigrateDataPaymentMethodsStores < ActiveRecord::Migration[5.2]
def up
Spree::PaymentMethod.all.each do |payment_method|
next if payment_method.store_ids.any?
diff --git a/core/db/migrate/20210117112551_remove_store_id_from_spree_payment_methods.rb b/core/db/migrate/20210117112551_remove_store_id_from_spree_payment_methods.rb
index abf407866a..7ee51e93b2 100644
--- a/core/db/migrate/20210117112551_remove_store_id_from_spree_payment_methods.rb
+++ b/core/db/migrate/20210117112551_remove_store_id_from_spree_payment_methods.rb
@@ -1,4 +1,4 @@
-class RemoveStoreIdFromSpreePaymentMethods < ActiveRecord::Migration[6.0]
+class RemoveStoreIdFromSpreePaymentMethods < ActiveRecord::Migration[5.2]
def change
remove_column :spree_payment_methods, :store_id, :integer
end
diff --git a/core/db/migrate/20210120142527_ensure_default_locale_in_spree_stores.rb b/core/db/migrate/20210120142527_ensure_default_locale_in_spree_stores.rb
index 73277f23bd..f3cb766220 100644
--- a/core/db/migrate/20210120142527_ensure_default_locale_in_spree_stores.rb
+++ b/core/db/migrate/20210120142527_ensure_default_locale_in_spree_stores.rb
@@ -1,4 +1,4 @@
-class EnsureDefaultLocaleInSpreeStores < ActiveRecord::Migration[6.0]
+class EnsureDefaultLocaleInSpreeStores < ActiveRecord::Migration[5.2]
def change
Spree::Store.where(default_locale: nil).update_all(default_locale: I18n.locale)
end
diff --git a/core/db/migrate/20210205211040_add_supported_locales_to_spree_stores.rb b/core/db/migrate/20210205211040_add_supported_locales_to_spree_stores.rb
index 3ebb672dbf..4418be91d4 100644
--- a/core/db/migrate/20210205211040_add_supported_locales_to_spree_stores.rb
+++ b/core/db/migrate/20210205211040_add_supported_locales_to_spree_stores.rb
@@ -1,4 +1,4 @@
-class AddSupportedLocalesToSpreeStores < ActiveRecord::Migration[6.0]
+class AddSupportedLocalesToSpreeStores < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_stores, :supported_locales)
add_column :spree_stores, :supported_locales, :string
diff --git a/core/db/migrate/20210215202602_migrate_spree_i18n_globalize_config.rb b/core/db/migrate/20210215202602_migrate_spree_i18n_globalize_config.rb
index e58aa9c87e..84a2909892 100644
--- a/core/db/migrate/20210215202602_migrate_spree_i18n_globalize_config.rb
+++ b/core/db/migrate/20210215202602_migrate_spree_i18n_globalize_config.rb
@@ -1,4 +1,4 @@
-class MigrateSpreeI18nGlobalizeConfig < ActiveRecord::Migration[6.0]
+class MigrateSpreeI18nGlobalizeConfig < ActiveRecord::Migration[5.2]
def up
locales = []
diff --git a/core/db/migrate/20210407200948_create_spree_menus.rb b/core/db/migrate/20210407200948_create_spree_menus.rb
index 02244146bd..92a5984ba9 100644
--- a/core/db/migrate/20210407200948_create_spree_menus.rb
+++ b/core/db/migrate/20210407200948_create_spree_menus.rb
@@ -1,4 +1,4 @@
-class CreateSpreeMenus < ActiveRecord::Migration[6.0]
+class CreateSpreeMenus < ActiveRecord::Migration[5.2]
def change
create_table :spree_menus do |t|
t.column :name, :string
diff --git a/core/db/migrate/20210408092939_create_spree_menu_items.rb b/core/db/migrate/20210408092939_create_spree_menu_items.rb
index d943eb343b..d270838c8c 100644
--- a/core/db/migrate/20210408092939_create_spree_menu_items.rb
+++ b/core/db/migrate/20210408092939_create_spree_menu_items.rb
@@ -1,4 +1,4 @@
-class CreateSpreeMenuItems < ActiveRecord::Migration[6.0]
+class CreateSpreeMenuItems < ActiveRecord::Migration[5.2]
def change
create_table :spree_menu_items do |t|
t.column :name, :string, null: false
diff --git a/core/db/migrate/20210504163720_add_filter_param_to_spree_product_properties.rb b/core/db/migrate/20210504163720_add_filter_param_to_spree_product_properties.rb
index 333499a01e..6e59db076f 100644
--- a/core/db/migrate/20210504163720_add_filter_param_to_spree_product_properties.rb
+++ b/core/db/migrate/20210504163720_add_filter_param_to_spree_product_properties.rb
@@ -1,4 +1,4 @@
-class AddFilterParamToSpreeProductProperties < ActiveRecord::Migration[6.0]
+class AddFilterParamToSpreeProductProperties < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_product_properties, :filter_param)
add_column :spree_product_properties, :filter_param, :string
diff --git a/core/db/migrate/20210505114659_add_filter_param_to_spree_properties.rb b/core/db/migrate/20210505114659_add_filter_param_to_spree_properties.rb
index 6b727b8495..c985610bdf 100644
--- a/core/db/migrate/20210505114659_add_filter_param_to_spree_properties.rb
+++ b/core/db/migrate/20210505114659_add_filter_param_to_spree_properties.rb
@@ -1,4 +1,4 @@
-class AddFilterParamToSpreeProperties < ActiveRecord::Migration[6.0]
+class AddFilterParamToSpreeProperties < ActiveRecord::Migration[5.2]
def change
unless column_exists?(:spree_properties, :filter_param)
add_column :spree_properties, :filter_param, :string
diff --git a/guides/src/content/developer/4_advanced/extend_product_attributes.md b/guides/src/content/developer/4_advanced/extend_product_attributes.md
index 9547701aa6..3c0d16a5f9 100644
--- a/guides/src/content/developer/4_advanced/extend_product_attributes.md
+++ b/guides/src/content/developer/4_advanced/extend_product_attributes.md
@@ -15,7 +15,7 @@ Note: Replace `RailsappName` and `railsapp_name` with your actualy Rails App Nam
Create a migration that extends your spree products table. `rails g migration AddFieldsToSpreeProducts short_description:text` should create this migration
```ruby
-class AddFieldsToSpreeProducts < ActiveRecord::Migration[6.0]
+class AddFieldsToSpreeProducts < ActiveRecord::Migration[5.2]
def change
add_column :spree_products, :short_description, :text
end