Sha256: 89553998655b7d97fc51197b8cb457c80b9422868032ae3ac523240fc431c2b7

Contents?: true

Size: 673 Bytes

Versions: 7

Compression:

Stored size: 673 Bytes

Contents

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

  class System < ApplicationRecord
    self.table_name = "katello_systems"
  end

  def up
    add_column :hosts, :description, :text

    System.find_each do |system|
      system.foreman_host.update_attribute(:description, system.description)
    end

    remove_column :katello_systems, :description
  end

  def down
    add_column :katello_systems, :description, :text

    System.find_each do |system|
      system.update_attribute(:description, system.foreman_host.description)
    end

    remove_column :hosts, :description
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
katello-3.5.2 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.5.1.1 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.5.1 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.5.0.1 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.5.0 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.5.0.rc2 db/migrate/20160222143432_move_system_description_to_host.rb
katello-3.5.0.rc1 db/migrate/20160222143432_move_system_description_to_host.rb