We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e9bb783 + fb96b33 commit 15f51d5Copy full SHA for 15f51d5
1 file changed
db/migrate/20240825141541_fix_bad_kits.rb
@@ -0,0 +1,25 @@
1
+class FixBadKits < ActiveRecord::Migration[7.1]
2
+ def change
3
+ return unless Rails.env.production?
4
+
5
+ ids = [78, 204,189]
6
+ kit_base_item = BaseItem.find_or_create_by!({
7
+ name: 'Kit',
8
+ category: 'kit',
9
+ partner_key: 'kit'
10
+ })
11
+ Kit.where(id: ids).each do |kit|
12
+ result = ItemCreateService.new(
13
+ organization_id: kit.organization.id,
14
+ item_params: {
15
+ name: kit.name,
16
+ partner_key: kit_base_item.partner_key,
17
+ kit_id: kit.id
18
+ }
19
+ ).call
20
+ unless result.success?
21
+ raise result.error
22
+ end
23
24
25
+end
0 commit comments