-
-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4619 from rubyforgood/fix-bad-event
Add data migration to fix errant distribution+event
- Loading branch information
Showing
2 changed files
with
13 additions
and
1 deletion.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
db/migrate/20240830015517_fix_invalid_distribution_event.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class FixInvalidDistributionEvent < 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: 34416, eventable_type: 'Distribution', eventable_id: 75002).first.destroy | ||
Distribution.find(75002).destroy | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters