OSDN Git Service

fix extend for profiler
[pettanr/pettanr.git] / db / migrate / 20140329222717_fix_extend_system_data.rb
1 class FixExtendSystemData < ActiveRecord::Migration
2   def up
3     Balloon.find(:all).each do |balloon|
4       sbt = balloon.speech_balloon.speech_balloon_template
5       if balloon.speech_balloon_template_classname == 'noname'
6         balloon.speech_balloon_template_id = sbt.id
7         balloon.speech_balloon_template_classname = sbt.classname
8         balloon.save!
9       end
10     end
11     Speech.find(:all).each do |speech|
12       sbt = speech.speech_balloon.speech_balloon_template
13       if speech.speech_balloon_template_classname == 'noname'
14         speech.speech_balloon_template_id = sbt.id
15         speech.speech_balloon_template_classname = sbt.classname
16         speech.save!
17       end
18       wf =  speech.writing_format
19       if speech.writing_format_classname == 'noname'
20         speech.writing_format_classname = wf.classname
21         speech.save!
22       end
23     end
24     License.find(:all).each do |license|
25       lg = license.license_group
26       if license.license_group_classname == 'noname'
27         license.license_group_classname = lg.classname
28         license.save!
29       end
30     end
31   end
32
33   def down
34   end
35 end