Sha256: ec74b54dba49ca36187521b2358883eff5a27288921411914d0cedbea66cf0f4

Contents?: true

Size: 569 Bytes

Versions: 2

Compression:

Stored size: 569 Bytes

Contents

class MigrateCoreTypes < ActiveRecord::Migration[6.0]
  def up
    Permission.where(:resource_type => 'Trend').update_all(:resource_type => 'ForemanStatistics::Trend')
    %w[ForemanTrend FactTrend Trend].each do |t|
      Trend.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|
      Trend.where(:type => "ForemanStatistics::#{t}").update_all(:type => t)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_statistics-0.1.1 db/migrate/20200605153005_migrate_core_types.rb
foreman_statistics-0.1.0 db/migrate/20200605153005_migrate_core_types.rb