Skip to content

Commit 893b3df

Browse files
authored
Fix SCDB's issue with event history -- duplicate distribution. (#4777)
1 parent ba99d54 commit 893b3df

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class FixInvalidDistributionEvent20241112 < ActiveRecord::Migration[7.1]
2+
def change
3+
return unless Rails.env.production?
4+
5+
# We are not sure why yet, but this org was able to create a distribution
6+
# that put them at a negative inventory. Later playback of the events with
7+
# validation turned on then raised it as an error. For now we are deleting
8+
# the distribution and event directly.
9+
Event.where(id: 42075, eventable_type: 'Distribution', eventable_id: 789204).first.destroy
10+
Distribution.find(789204).destroy
11+
end
12+
end

0 commit comments

Comments
 (0)