Sha256: b1d8b292e5eafd45106e7350ad5100cbb7e145f270dbade4c908da75ba3fb73e

Contents?: true

Size: 490 Bytes

Versions: 4

Compression:

Stored size: 490 Bytes

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
foreman_bootdisk-12.0.1 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-13.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-12.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-11.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb