Sha256: c0d7398a13b08a11a51fc96e67529e11f5a5a3169cea436a01374229b62709c6

Contents?: true

Size: 690 Bytes

Versions: 6

Compression:

Stored size: 690 Bytes

Contents

class MoveSystemDescriptionToHost < ActiveRecord::Migration
  class Host < ActiveRecord::Base
    self.table_name = "hosts"
  end

  class System < ActiveRecord::Base
    self.table_name = "katello_systems"
  end

  def up
    add_column :hosts, :description, :text

    System.find_each do |system|
      system.foreman_host.description = system.description
      system.foreman_host.save!
    end

    remove_column :katello_systems, :description
  end

  def down
    add_column :katello_systems, :description, :text

    System.find_each do |system|
      system.description = system.foreman_host.description
      system.save!
    end

    remove_column :hosts, :description
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
katello-3.0.0.rc7 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.0.0.rc5 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.0.0.rc4 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.0.0.rc3 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.0.0.rc2 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.0.0.rc1 db/migrate/20160222143432_move_system_description_to_host.rb