Skip to content

Commit

Permalink
Remove Spree::Adjustment#promotion_code_id from core
Browse files Browse the repository at this point in the history
This moves the column into solidus_legacy_promotions, which is the only
place it's used at.
  • Loading branch information
mamhoff committed Jun 22, 2024
1 parent 07d39c0 commit 91ba272
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 0 additions & 2 deletions core/db/migrate/20160101010000_solidus_one_four.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ def up
t.datetime "updated_at", precision: 6
t.integer "order_id", null: false
t.boolean "included", default: false
t.integer "promotion_code_id"
t.integer "adjustment_reason_id"
t.boolean "finalized", default: false, null: false
t.index ["adjustable_id", "adjustable_type"], name: "index_spree_adjustments_on_adjustable_id_and_adjustable_type"
t.index ["adjustable_id"], name: "index_adjustments_on_order_id"
t.index ["eligible"], name: "index_spree_adjustments_on_eligible"
t.index ["order_id"], name: "index_spree_adjustments_on_order_id"
t.index ["promotion_code_id"], name: "index_spree_adjustments_on_promotion_code_id"
t.index ["source_id", "source_type"], name: "index_spree_adjustments_on_source_id_and_source_type"
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class AddPromotionCodeIdToSpreeAdjustments < ActiveRecord::Migration[5.0]
def up
unless column_exists?(:spree_adjustments, :promotion_code_id)
add_column :spree_adjustments, :promotion_code_id, :integer
end
unless index_exists?(:spree_adjustments, :promotion_code_id)
add_index :spree_adjustments, :promotion_code_id, name: "index_spree_adjustments_on_promotion_code_id"
end
end
end
1 change: 1 addition & 0 deletions legacy_promotions/spec/models/spree/adjustment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

let(:adjustment) { Spree::Adjustment.create!(label: 'Adjustment', adjustable: order, order: order, amount: 5) }

it { is_expected.to respond_to(:promotion_code) }
context '#recalculate' do
subject { adjustment.recalculate }
let(:adjustment) do
Expand Down

0 comments on commit 91ba272

Please sign in to comment.