Show More
Commit Description:
- fix hof when user is deleted...
Commit Description:
- fix hof when user is deleted
- user/:id/stat only show available problem for non-admin user
References:
File last commit:
Show/Diff file:
Action:
db/migrate/028_refactor_problem_body_to_description.rb
| 33 lines
| 854 B
| text/x-ruby
| RubyLexer
|
|
r92 | class RefactorProblemBodyToDescription < ActiveRecord::Migration | ||
def self.up | ||||
add_column :problems, :description_id, :integer | ||||
Problem.reset_column_information | ||||
Problem.find(:all).each do |problem| | ||||
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 | ||||
Problem.find(:all).each do |problem| | ||||
if problem.description_id != nil | ||||
problem.body = Description.find(problem.description_id).body | ||||
problem.save | ||||
end | ||||
end | ||||
remove_column :problems, :description_id | ||||
end | ||||
end | ||||