-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Similar to the scenario of multiple promotions, we need to account for multiple actions on the same promotion. Also here we need to sort by explicit priority when allowing cumulative promotions.
- Loading branch information
Showing
2 changed files
with
23 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
core/db/migrate/20220329104242_add_priority_to_spree_promotion_actions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddPriorityToSpreePromotionActions < ActiveRecord::Migration[5.2] | ||
def up | ||
add_column :spree_promotion_actions, :priority, :integer | ||
sql = <<~SQL | ||
UPDATE spree_promotion_actions | ||
SET priority = id | ||
SQL | ||
execute(sql) | ||
change_column :spree_promotion_actions, :priority, :integer, null: false | ||
end | ||
|
||
def down | ||
remove_column :spree_promotion_actions, :priority, :integer, null: false | ||
end | ||
end |