Skip to content

Commit

Permalink
Fix sql for mysql MigrateAdjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
davecandlescience committed Oct 26, 2023
1 parent b1f4d07 commit 5a8a003
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/solidus_friendly_promotions/migrate_adjustments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ class << self
def up
sql = <<~SQL
UPDATE spree_adjustments
INNER JOIN spree_promotion_actions ON spree_adjustments.source_id = spree_promotion_actions.id and spree_adjustments.source_type = 'Spree::PromotionAction'
INNER JOIN friendly_promotion_actions ON friendly_promotion_actions.original_promotion_action_id = spree_promotion_actions.id
SET source_id = friendly_promotion_actions.id,
source_type = 'SolidusFriendlyPromotions::PromotionAction'
FROM spree_promotion_actions
INNER JOIN friendly_promotion_actions ON friendly_promotion_actions.original_promotion_action_id = spree_promotion_actions.id
WHERE spree_adjustments.source_id = spree_promotion_actions.id and spree_adjustments.source_type = 'Spree::PromotionAction'
SQL

execute(sql)
Expand All @@ -19,11 +18,11 @@ def up
def down
sql = <<~SQL
UPDATE spree_adjustments
INNER JOIN friendly_promotion_actions
INNER JOIN spree_promotion_actions ON spree_adjustments.source_id = friendly_promotion_actions.id and spree_adjustments.source_type = 'SolidusFriendlyPromotions::PromotionAction'
SET source_id = spree_promotion_actions.id,
source_type = 'Spree::PromotionAction'
FROM spree_promotion_actions
INNER JOIN friendly_promotion_actions ON friendly_promotion_actions.original_promotion_action_id = spree_promotion_actions.id
WHERE spree_adjustments.source_id = friendly_promotion_actions.id and spree_adjustments.source_type = 'SolidusFriendlyPromotions::PromotionAction'
WHERE friendly_promotion_actions.original_promotion_action_id = spree_promotion_actions.id
SQL

execute(sql)
Expand Down

0 comments on commit 5a8a003

Please sign in to comment.