Sha256: f4a19ff49a79d82e432f92ba28f874894ddba86276f4ca21d63c6288f11ab079
Contents?: true
Size: 596 Bytes
Versions: 32
Compression:
Stored size: 596 Bytes
Contents
# frozen_string_literal: true class SetPromotionsWithAnyPolicyToAllIfPossible < ActiveRecord::Migration[5.2] def up Spree::Promotion.where(match_policy: :any).includes(:promotion_rules).all.each do |promotion| if promotion.promotion_rules.length <= 1 promotion.update!(match_policy: :all) else raise StandardError, <<~MSG You have promotions with a match policy of any and more than one rule. Please run `bundle exec rake solidus:split_promotions_with_any_match_policy`. MSG end end end def down # No-Op end end
Version data entries
32 entries across 32 versions & 1 rubygems