Sha256: f5f0c8217c9047b6ae90c006571615e021979297c1689f0f7c2e9355808e8677
Contents?: true
Size: 810 Bytes
Versions: 11
Compression:
Stored size: 810 Bytes
Contents
class ChangeTemplatekindToBootdisk < ActiveRecord::Migration def self.up kind = TemplateKind.find_or_create_by_name('Bootdisk') tmpl_h = Setting.find_by_name('bootdisk_host_template').try(:value) tmpl_g = Setting.find_by_name('bootdisk_generic_host_template').try(:value) (ConfigTemplate.unscoped.where('name LIKE ?', '%Boot disk%') | ConfigTemplate.unscoped.where(:name => [tmpl_h, tmpl_g].compact)).each do |tmpl| tmpl.update_attribute(:template_kind_id, kind.id) end end def self.down old_kind = TemplateKind.find_by_name('Bootdisk') new_kind = TemplateKind.find_by_name('iPXE') if old_kind.present? && new_kind.present? ConfigTemplate.unscoped.where(:template_kind_id => old_kind.id).update_all(:template_kind_id => new_kind.id) end end end
Version data entries
11 entries across 11 versions & 1 rubygems