Skip to content

Commit

Permalink
Fix SCDB's issue with event history -- duplicate distribution. (#4777)
Browse files Browse the repository at this point in the history
  • Loading branch information
cielf authored Nov 12, 2024
1 parent ba99d54 commit 893b3df
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class FixInvalidDistributionEvent20241112 < ActiveRecord::Migration[7.1]
def change
return unless Rails.env.production?

# We are not sure why yet, but this org was able to create a distribution
# that put them at a negative inventory. Later playback of the events with
# validation turned on then raised it as an error. For now we are deleting
# the distribution and event directly.
Event.where(id: 42075, eventable_type: 'Distribution', eventable_id: 789204).first.destroy
Distribution.find(789204).destroy
end
end

0 comments on commit 893b3df

Please sign in to comment.