Skip to content

Commit

Permalink
Merge pull request rubyforgood#4611 from rubyforgood/fix-bad-kits
Browse files Browse the repository at this point in the history
Fix bad kits
  • Loading branch information
awwaiid authored Aug 25, 2024
2 parents e9bb783 + fb96b33 commit 15f51d5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions db/migrate/20240825141541_fix_bad_kits.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class FixBadKits < ActiveRecord::Migration[7.1]
def change
return unless Rails.env.production?

ids = [78, 204,189]
kit_base_item = BaseItem.find_or_create_by!({
name: 'Kit',
category: 'kit',
partner_key: 'kit'
})
Kit.where(id: ids).each do |kit|
result = ItemCreateService.new(
organization_id: kit.organization.id,
item_params: {
name: kit.name,
partner_key: kit_base_item.partner_key,
kit_id: kit.id
}
).call
unless result.success?
raise result.error
end
end
end
end

0 comments on commit 15f51d5

Please sign in to comment.