mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Remove unrequired credit_card_id field from subscriptions table
This commit is contained in:
committed by
Maikel Linke
parent
21c3f7d21c
commit
4863f2b5b4
@@ -8,7 +8,6 @@ class Subscription < ActiveRecord::Base
|
||||
belongs_to :payment_method, class_name: 'Spree::PaymentMethod'
|
||||
belongs_to :bill_address, foreign_key: :bill_address_id, class_name: Spree::Address
|
||||
belongs_to :ship_address, foreign_key: :ship_address_id, class_name: Spree::Address
|
||||
belongs_to :credit_card, foreign_key: :credit_card_id, class_name: 'Spree::CreditCard'
|
||||
has_many :subscription_line_items, inverse_of: :subscription
|
||||
has_many :order_cycles, through: :schedule
|
||||
has_many :proxy_orders
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class RemoveCreditCardFromSubscriptions < ActiveRecord::Migration
|
||||
def up
|
||||
remove_foreign_key :subscriptions, name: :subscriptions_credit_card_id_fk
|
||||
remove_index :subscriptions, :credit_card_id
|
||||
remove_column :subscriptions, :credit_card_id
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :subscriptions, :credit_card_id, :integer
|
||||
add_index :subscriptions, :credit_card_id
|
||||
add_foreign_key :subscriptions, :spree_credit_cards, name: :subscriptions_credit_card_id_fk, column: :credit_card_id
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20180418025217) do
|
||||
ActiveRecord::Schema.define(:version => 20180510083800) do
|
||||
|
||||
create_table "account_invoices", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
@@ -1118,13 +1118,11 @@ ActiveRecord::Schema.define(:version => 20180418025217) do
|
||||
t.integer "ship_address_id", :null => false
|
||||
t.datetime "canceled_at"
|
||||
t.datetime "paused_at"
|
||||
t.integer "credit_card_id"
|
||||
t.decimal "shipping_fee_estimate", :precision => 8, :scale => 2
|
||||
t.decimal "payment_fee_estimate", :precision => 8, :scale => 2
|
||||
end
|
||||
|
||||
add_index "subscriptions", ["bill_address_id"], :name => "index_subscriptions_on_bill_address_id"
|
||||
add_index "subscriptions", ["credit_card_id"], :name => "index_subscriptions_on_credit_card_id"
|
||||
add_index "subscriptions", ["customer_id"], :name => "index_subscriptions_on_customer_id"
|
||||
add_index "subscriptions", ["payment_method_id"], :name => "index_subscriptions_on_payment_method_id"
|
||||
add_index "subscriptions", ["schedule_id"], :name => "index_subscriptions_on_schedule_id"
|
||||
@@ -1363,7 +1361,6 @@ ActiveRecord::Schema.define(:version => 20180418025217) do
|
||||
add_foreign_key "subscriptions", "schedules", name: "subscriptions_schedule_id_fk"
|
||||
add_foreign_key "subscriptions", "spree_addresses", name: "subscriptions_bill_address_id_fk", column: "bill_address_id"
|
||||
add_foreign_key "subscriptions", "spree_addresses", name: "subscriptions_ship_address_id_fk", column: "ship_address_id"
|
||||
add_foreign_key "subscriptions", "spree_credit_cards", name: "subscriptions_credit_card_id_fk", column: "credit_card_id"
|
||||
add_foreign_key "subscriptions", "spree_payment_methods", name: "subscriptions_payment_method_id_fk", column: "payment_method_id"
|
||||
add_foreign_key "subscriptions", "spree_shipping_methods", name: "subscriptions_shipping_method_id_fk", column: "shipping_method_id"
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ describe Subscription, type: :model do
|
||||
it { expect(subject).to belong_to(:payment_method) }
|
||||
it { expect(subject).to belong_to(:ship_address) }
|
||||
it { expect(subject).to belong_to(:bill_address) }
|
||||
it { expect(subject).to belong_to(:credit_card) }
|
||||
it { expect(subject).to have_many(:subscription_line_items) }
|
||||
it { expect(subject).to have_many(:order_cycles) }
|
||||
it { expect(subject).to have_many(:proxy_orders) }
|
||||
|
||||
Reference in New Issue
Block a user