Sha256: 7710d4520ac52abfe29904f08e91630eee8d6550dabe4b7d47bdb10c1c9fa3e0

Contents?: true

Size: 534 Bytes

Versions: 184

Compression:

Stored size: 534 Bytes

Contents

class AddForeignKeyToHypervisorId < ActiveRecord::Migration[5.1]
  def up
    # Update all pools that have a hypervisor reference that's not a host before we add the FK
    ::Katello::Pool.where.not(hypervisor_id: nil).where.not(hypervisor_id: Host::Managed.all).update_all(hypervisor_id: nil)

    add_foreign_key(:katello_pools, :hosts,
                    :name => 'katello_pools_hypervisor_fk', :column => 'hypervisor_id')
  end

  def down
    remove_foreign_key(:katello_pools, :name => 'katello_pools_hypervisor_fk')
  end
end

Version data entries

184 entries across 184 versions & 1 rubygems

Version Path
katello-4.14.2 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.15.0 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.15.0.rc2 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.15.0.rc1 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.14.1 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.14.0 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.14.0.rc3 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.14.0.rc2 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.14.0.rc1.1 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.14.0.rc1 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.13.1 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.13.0 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.12.1 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.13.0.rc1 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.12.0 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.12.0.rc3 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.12.0.rc2 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.12.0.rc1 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.11.1 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb
katello-4.11.0 db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb