Sha256: ae056b567770b87a9d8969ce7d0a5005947cff5b4793371e0debacb41a461fe6

Contents?: true

Size: 1.06 KB

Versions: 47

Compression:

Stored size: 1.06 KB

Contents

class MigratePuppetCoreTypes < ActiveRecord::Migration[6.0]
  def up
    %w[PuppetclassLookupKey Puppetclass Environment ConfigGroup].each do |type|
      Audit.where(auditable_type: type).update_all(auditable_type: "ForemanPuppet::#{type}")
      Permission.where(resource_type: type).update_all(resource_type: "ForemanPuppet::#{type}")
    end
    LookupKey.where(type: 'PuppetclassLookupKey').update_all(type: 'ForemanPuppet::PuppetclassLookupKey')
    TaxableTaxonomy.where(taxable_type: 'Environment').update_all(taxable_type: 'ForemanPuppet::Environment')
  end

  def down
    %w[PuppetclassLookupKey Puppetclass Environment ConfigGroup].each do |type|
      Audit.where(auditable_type: "ForemanPuppet::#{type}").update_all(auditable_type: type)
      Permission.where(resource_type: "ForemanPuppet::#{type}").update_all(resource_type: type)
    end
    LookupKey.where(type: 'ForemanPuppet::PuppetclassLookupKey').update_all(type: 'PuppetclassLookupKey')
    TaxableTaxonomy.where(taxable_type: 'ForemanPuppet::Environment').update_all(taxable_type: 'Environment')
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
foreman_puppet-8.0.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-6.4.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-7.0.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-6.3.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-6.2.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-6.1.1 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-5.1.3 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-6.1.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-6.0.1 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-6.0.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-5.1.2 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-4.1.1 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-5.1.1 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-5.1.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-4.1.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-4.0.4 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-5.0.0 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-4.0.3 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-4.0.2 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb
foreman_puppet-3.0.7 db/migrate/20200720123005_migrate_puppet_core_types.foreman_puppet.rb