blob: f6ee6c23cf529a6e404537f91a8feb372b2c7d6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
class UpdatePromotionRuleNames < ActiveRecord::Migration[5.2]
TYPE_RENAMES = {
'SolidusSubscriptions::SubscriptionPromotionRule' => 'SolidusSubscriptions::Promotion::Rules::SubscriptionCreationOrder',
'SolidusSubscriptions::SubscriptionOrderPromotionRule' => 'SolidusSubscriptions::Promotion::Rules::SubscriptionInstallmentOrder',
}.freeze
def change
reversible do |dir|
dir.up do
TYPE_RENAMES.each do |old_type, new_type|
Spree::PromotionRule.where(type: old_type).update(type: new_type)
end
end
dir.down do
TYPE_RENAMES.each do |old_type, new_type|
Spree::PromotionRule.where(type: new_type).update(type: old_type)
end
end
end
end
end
|