Sha256: e91934dd1baaab72a1aa19ffb6bb035ed70a65e7d5768fd611f24f3715714c4f

Contents?: true

Size: 509 Bytes

Versions: 35

Compression:

Stored size: 509 Bytes

Contents

# frozen_string_literal: true

class RemoveDuplicateBootdiskTemplates < ActiveRecord::Migration[4.2]
  def up
    template_names = ['Boot disk iPXE - host', 'Boot disk iPXE - generic host']
    template_names.each do |template_name|
      duplicate_template_ids = ProvisioningTemplate.unscoped.where(name: template_name, locked: true).order(created_at: :asc).pluck(:id).drop(1)
      ProvisioningTemplate.unscoped.where(id: duplicate_template_ids).destroy_all if duplicate_template_ids.any?
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
foreman_bootdisk-22.0.2 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-22.0.1 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-22.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.0.6 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.2.3 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.2.2 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.0.5 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.2.1 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.2.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.1.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.9 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.0.4 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.0.3 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.8 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.0.2 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.7 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.0.1 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-21.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.6 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.4.1 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb