Sha256: 86a88396564c987a17bd23cbfc3c75236a05db024db3ff468c36b47db5d17fe9

Contents?: true

Size: 733 Bytes

Versions: 36

Compression:

Stored size: 733 Bytes

Contents

class RemoveKatelloFromNotificationName < ActiveRecord::Migration
  class FakeMailNotification < ActiveRecord::Base
    self.table_name = 'mail_notifications'
  end

  def up
    FakeMailNotification.all.each do |notification|
      if notification_names.keys.include?(notification.name)
        new_name = notification_names[notification.name]
        FakeMailNotification.where(:name => new_name).destroy_all
        notification.name = new_name
        notification.save!
      end
    end
  end

  private

  def notification_names
    {
      :katello_promote_errata => 'promote_errata',
      :katello_sync_errata => 'sync_errata',
      :katello_host_advisory => 'host_errata_advisory'
    }.with_indifferent_access
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
katello-3.2.0.rc3 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.2.0.rc2 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.2.0.rc1.1 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.2.0.rc1 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.1.0.1 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.1.0 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.1.0.rc2.1 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.0.2 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.1.0.rc1 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.0.1 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.0.0 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.0.0.rc7 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.0.0.rc5 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.0.0.rc4 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.0.0.rc3 db/migrate/20160404132250_remove_katello_from_notification_name.rb
katello-3.0.0.rc2 db/migrate/20160404132250_remove_katello_from_notification_name.rb