Commit 6a9f63109002bcc582d370437f2ed6514dfd7b85
Committed by
Robert Lail
1 parent
17c9c54f
Exists in
master
and in
1 other branch
Migrated first_notice_at to Problem
Showing
1 changed file
with
10 additions
and
0 deletions
Show diff stats
db/migrate/20120822195841_set_first_notice_at_on_problems.rb
0 → 100644
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +class SetFirstNoticeAtOnProblems < Mongoid::Migration | ||
2 | + def self.up | ||
3 | + Problem.all.each do |problem| | ||
4 | + problem.update_attribute :first_notice_at, problem.notices.order_by([:created_at, :asc]).first.try(:created_at) | ||
5 | + end | ||
6 | + end | ||
7 | + | ||
8 | + def self.down | ||
9 | + end | ||
10 | +end | ||
0 | \ No newline at end of file | 11 | \ No newline at end of file |