Class: CreateDefaultImpacts
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateDefaultImpacts
- Defined in:
- lib/db/migrate/20101122145008_create_default_impacts.rb
Constant Summary collapse
- IMPACT_DEFAULTS =
%w[NONE PARTIAL COMPLETE]
Class Method Summary collapse
Class Method Details
.down ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/db/migrate/20101122145008_create_default_impacts.rb', line 11 def self.down IMPACT_DEFAULTS.each do |name| impacts = FIDIUS::CveDb::Impact.where({ :name => name }) impacts.each do |impact| impact.destroy! end end end |
.up ⇒ Object
5 6 7 8 9 |
# File 'lib/db/migrate/20101122145008_create_default_impacts.rb', line 5 def self.up IMPACT_DEFAULTS.each do |name| FIDIUS::CveDb::Impact.find_or_create_by_name(name) end end |