Skip to content

Commit

Permalink
Fix bad kits
Browse files Browse the repository at this point in the history
  • Loading branch information
dorner committed Aug 25, 2024
1 parent e9bb783 commit fb96b33
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 fb96b33

Please sign in to comment.