Sha256: cf61ba8d4fc79255b7dffe700afb5ce304efa2044f8dfe2e08adb1ed75cb5cf2
Contents?: true
Size: 449 Bytes
Versions: 5
Compression:
Stored size: 449 Bytes
Contents
class AddLabelToHostGroup < ActiveRecord::Migration def self.up add_column :hostgroups, :label, :string Hostgroup.reset_column_information execute "UPDATE hostgroups set label = name WHERE ancestry IS NULL" Hostgroup.where("ancestry IS NOT NULL").each do |hostgroup| hostgroup.label = hostgroup.get_label hostgroup.save_without_auditing end end def self.down remove_column :hostgroups, :label end end
Version data entries
5 entries across 5 versions & 1 rubygems