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-19.0.5 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.4 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.3 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.2 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.1 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-19.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-18.1.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-18.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-17.1.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-17.0.2 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-16.1.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-16.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-15.1.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-15.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb
foreman_bootdisk-14.0.0 db/migrate/20171009225200_remove_duplicate_bootdisk_templates.rb