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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Credit Card model drop DB connection check for paranoia as it's not reliable (#11224)
Damian Legawiec5165564429d3
diff --git a/core/app/models/spree/credit_card.rb b/core/app/models/spree/credit_card.rbindex 77ead76802..ece8d9a65d 100644--- a/core/app/models/spree/credit_card.rb+++ b/core/app/models/spree/credit_card.rb@@ -2,13 +2,7 @@ module Spreeclass CreditCard < Spree::Baseinclude ActiveMerchant::Billing::CreditCardMethods- # to migrate safely from older Spree versions that din't provide safe deletion for CCs- # we need to ensure that we have a connection to the DB and that the `deleted_at` column exists- if !ENV['SPREE_DISABLE_DB_CONNECTION'] &&- table_exists? &&- connection.column_exists?(:spree_credit_cards, :deleted_at)- acts_as_paranoid- end+ acts_as_paranoidbelongs_to :payment_methodbelongs_to :user, class_name: Spree.user_class.to_s, foreign_key: 'user_id',diff --git a/core/db/migrate/20140805171219_make_existing_credit_cards_default.rb b/core/db/migrate/20140805171219_make_existing_credit_cards_default.rbdeleted file mode 100644index 4d50d96f96..0000000000--- a/core/db/migrate/20140805171219_make_existing_credit_cards_default.rb+++ /dev/null@@ -1,10 +0,0 @@-class MakeExistingCreditCardsDefault < ActiveRecord::Migration[4.2]- def up- # set the newest credit card for every user to be the default; SQL technique from- # http://stackoverflow.com/questions/121387/fetch-the-row-which-has-the-max-value-for-a-column- Spree::CreditCard.where.not(user_id: nil).joins("LEFT OUTER JOIN spree_credit_cards cc2 ON cc2.user_id = spree_credit_cards.user_id AND spree_credit_cards.created_at < cc2.created_at").where("cc2.user_id IS NULL").update_all(default: true)- end- def down- # do nothing- end-end