1
0
Fork 0
dokkan-data-rails/db/migrate/20151109165630_add_cost_sta...

17 lines
361 B
Ruby

class AddCostStatToCard < ActiveRecord::Migration
def self.up
add_column :cards, :cost_stat_id, :integer
PaperTrail.whodunnit = 1
StatType.create(name: 'Cost', description: 'Cost')
Card.all.each do |c|
c.cost_stat = Stat.new(stat_type_id: 4)
c.save
end
end
def self.down
remove_column :cards, :cost_stat_id
end
end