Sha256: 2df972d358bdb8eb4a8e341692f5b43409446c838aa98ad37c1af2252450f031

Contents?: true

Size: 653 Bytes

Versions: 9

Compression:

Stored size: 653 Bytes

Contents

class MigrateCoreTypes < ActiveRecord::Migration[6.0]
  class FakeTrend < ApplicationRecord
    self.table_name = 'trends'
  end

  def up
    Permission.where(:resource_type => 'Trend').update_all(:resource_type => 'ForemanStatistics::Trend')
    %w[ForemanTrend FactTrend Trend].each do |t|
      FakeTrend.where(:type => t).update_all(:type => "ForemanStatistics::#{t}")
    end
  end

  def down
    Permission.where(:resource_type => 'ForemanStatistics::Trend').update_all(:resource_type => 'Trend')
    %w[ForemanTrend FactTrend Trend].each do |t|
      FakeTrend.where(:type => "ForemanStatistics::#{t}").update_all(:type => t)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_statistics-2.1.0 db/migrate/20200605153005_migrate_core_types.rb
foreman_statistics-2.0.1 db/migrate/20200605153005_migrate_core_types.rb
foreman_statistics-2.0.0 db/migrate/20200605153005_migrate_core_types.rb
foreman_statistics-1.2.0 db/migrate/20200605153005_migrate_core_types.rb
foreman_statistics-1.1.1 db/migrate/20200605153005_migrate_core_types.rb
foreman_statistics-1.1.0 db/migrate/20200605153005_migrate_core_types.rb
foreman_statistics-1.0.0 db/migrate/20200605153005_migrate_core_types.rb
foreman_statistics-0.1.3 db/migrate/20200605153005_migrate_core_types.rb
foreman_statistics-0.1.2 db/migrate/20200605153005_migrate_core_types.rb