Sha256: 04861e476f62f45aa28bb3538e35d5f66cdf8c07ce8c101f91d4ea309adae35c

Contents?: true

Size: 732 Bytes

Versions: 7

Compression:

Stored size: 732 Bytes

Contents

class RemoveKatelloFromNotificationName < ActiveRecord::Migration
  class FakeMailNotification < ApplicationRecord
    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

7 entries across 7 versions & 1 rubygems

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