Show More
Commit Description:
update to 3.1.0, update rdoc
Commit Description:
update to 3.1.0, update rdoc
References:
File last commit:
Show/Diff file:
Action:
db/migrate/028_refactor_problem_body_to_description.rb
| 33 lines
| 840 B
| text/x-ruby
| RubyLexer
|
|
r92 | class RefactorProblemBodyToDescription < ActiveRecord::Migration | ||
def self.up | ||||
add_column :problems, :description_id, :integer | ||||
Problem.reset_column_information | ||||
r666 | Problem.all.each do |problem| | |||
|
r92 | if problem.body!=nil | ||
description = Description.new | ||||
description.body = problem.body | ||||
description.markdowned = false | ||||
description.save | ||||
problem.description_id = description.id | ||||
problem.save | ||||
end | ||||
end | ||||
remove_column :problems, :body | ||||
end | ||||
def self.down | ||||
add_column :problems, :body, :text | ||||
Problem.reset_column_information | ||||
r666 | Problem.all.each do |problem| | |||
|
r92 | if problem.description_id != nil | ||
problem.body = Description.find(problem.description_id).body | ||||
problem.save | ||||
end | ||||
end | ||||
remove_column :problems, :description_id | ||||
end | ||||
end | ||||