-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make RemoveKatelloFromNotificationName a noop
- Loading branch information
Showing
1 changed file
with
4 additions
and
22 deletions.
There are no files selected for viewing
26 changes: 4 additions & 22 deletions
26
db/migrate/20160404132250_remove_katello_from_notification_name.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,8 @@ | ||
class RemoveKatelloFromNotificationName < ActiveRecord::Migration[4.2] | ||
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 | ||
# historical placeholder | ||
# only required on setups before https://projects.theforeman.org/issues/14459 | ||
# we can safely assume that fresh installs have the above change already | ||
# and existing install had this migration applied back in 2016 | ||
end | ||
end |