Sha256: d08e1c7356d47c77fa513398ce85b60312eab2fa46c131e7b7e19a92879e2723

Contents?: true

Size: 1.32 KB

Versions: 65

Compression:

Stored size: 1.32 KB

Contents

class CreateCdnConfiguration < ActiveRecord::Migration[6.0]
  class FakeCdnConfiguration < Katello::Model
    self.table_name = 'katello_cdn_configurations'
  end

  def up
    create_table :katello_cdn_configurations do |t|
      t.integer :organization_id
      t.integer :ssl_ca_credential_id
      t.text :ssl_cert
      t.text :ssl_key
      t.string :username
      t.string :password
      t.string :upstream_organization_label
      t.string :url
    end

    add_foreign_key :katello_cdn_configurations, :taxonomies, name: 'katello_cdn_configurations_organization_id', column: :organization_id
    add_foreign_key :katello_cdn_configurations, :katello_content_credentials, name: 'katello_cdn_configurations_ssl_ca_credential_id', column: :ssl_ca_credential_id

    FakeCdnConfiguration.reset_column_information

    ::Organization.all.each do |org|
      FakeCdnConfiguration.where(
        organization_id: org.id,
        url: org.redhat_provider.repository_url || ::Katello::Resources::CDN::CdnResource.redhat_cdn_url
      ).first_or_create!
    end

    remove_column :katello_providers, :repository_url
    ::Katello::Provider.reset_column_information
  end

  def down
    add_column :katello_providers, :repository_url, :string
    ::Katello::Provider.reset_column_information
    drop_table :katello_cdn_configurations
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
katello-4.4.0.2 db/migrate/20211019192121_create_cdn_configuration.katello.rb
katello-4.4.0.1 db/migrate/20211019192121_create_cdn_configuration.katello.rb
katello-4.3.1 db/migrate/20211019192121_create_cdn_configuration.katello.rb
katello-4.4.0 db/migrate/20211019192121_create_cdn_configuration.katello.rb
katello-4.4.0.rc2 db/migrate/20211019192121_create_cdn_configuration.katello.rb