Sha256: ee294f9480e1d61ef5e7510b123682c1d3109be1e468117bfa498cc3b6366386
Contents?: true
Size: 658 Bytes
Versions: 10
Compression:
Stored size: 658 Bytes
Contents
# frozen_string_literal: true # This migration comes from spree (originally 20220317165036) 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
10 entries across 10 versions & 2 rubygems