Sha256: d36592ba99b64b0569fd80c825d3696fd95fed01ee0fc1724c4b56823b648486

Contents?: true

Size: 329 Bytes

Versions: 10

Compression:

Stored size: 329 Bytes

Contents

class RemoveDeletedPolicy < ActiveRecord::Migration
  def up
    ForemanOpenscap::AssetPolicy.all.collect(&:policy_id).uniq.each do |policy_id|
      execute("DELETE FROM foreman_openscap_asset_policies WHERE policy_id = '#{policy_id}';") if ForemanOpenscap::Policy.find_by_id(policy_id).nil?
    end
  end

  def down
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_openscap-0.7.1 db/migrate/20160830113437_remove_deleted_policy.rb
foreman_openscap-0.6.7 db/migrate/20160830113437_remove_deleted_policy.rb
foreman_openscap-0.7.0 db/migrate/20160830113437_remove_deleted_policy.rb
foreman_openscap-0.6.6 db/migrate/20160830113437_remove_deleted_policy.rb
foreman_openscap-0.6.5 db/migrate/20160830113437_remove_deleted_policy.rb
foreman_openscap-0.6.4 db/migrate/20160830113437_remove_deleted_policy.rb
foreman_openscap-0.6.3 db/migrate/20160830113437_remove_deleted_policy.rb
foreman_openscap-0.6.2 db/migrate/20160830113437_remove_deleted_policy.rb
foreman_openscap-0.6.1 db/migrate/20160830113437_remove_deleted_policy.rb
foreman_openscap-0.6.0 db/migrate/20160830113437_remove_deleted_policy.rb