Sha256: 8af605b34b14aa34450c6747f5e0ffa880fb3d13d64c4b1ada865368529f62b0

Contents?: true

Size: 647 Bytes

Versions: 3

Compression:

Stored size: 647 Bytes

Contents

class ChangeChangeContentSourceJobTemplateName < ActiveRecord::Migration[6.1]
  TEMPLATE_NAMES = {
    "Change content source" => "Configure host for new content source",
  }.freeze

  def up
    TEMPLATE_NAMES.each do |from, to|
      token = SecureRandom.base64(5)
      ::Template.unscoped.find_by(name: to)&.update_columns(:name => "#{to} Backup #{token}")
      ::Template.unscoped.find_by(name: from)&.update_columns(:name => to)
    end
  end

  def down
    TEMPLATE_NAMES.each do |from, to|
      ::Template.unscoped.find_by(name: from)&.delete
      ::Template.unscoped.find_by(name: to)&.update_columns(:name => from)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.15.0 db/migrate/20230717150442_change_change_content_source_job_template_name.rb
katello-4.15.0.rc2 db/migrate/20230717150442_change_change_content_source_job_template_name.rb
katello-4.15.0.rc1 db/migrate/20230717150442_change_change_content_source_job_template_name.rb