OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / db / migrate / 20140329222717_fix_extend_system_data.rb
1 class FixExtendSystemData < ActiveRecord::Migration
2   def up
3     Balloon.find_each do |balloon|
4       sbt = balloon.speech_balloon.speech_balloon_template
5       if balloon.speech_balloon_template_module_name == 'noname'
6         balloon.speech_balloon_template_id = sbt.id
7         balloon.speech_balloon_template_module_name = sbt.module_name
8         p balloon
9         balloon.boosts 'post'
10       end
11       balloon.save!
12     end
13     Speech.find_each do |speech|
14       sbt = speech.speech_balloon.speech_balloon_template
15       if speech.speech_balloon_template_module_name == 'noname'
16         speech.speech_balloon_template_id = sbt.id
17         speech.speech_balloon_template_module_name = sbt.module_name
18       end
19       wf =  speech.writing_format
20       if speech.writing_format_module_name == 'noname'
21         speech.writing_format_module_name = wf.module_name
22       end
23       speech.boosts 'post'
24       speech.save!
25     end
26     License.find_each do |license|
27       lg = license.license_group
28       if license.license_group_module_name == 'noname'
29         license.license_group_module_name = lg.module_name
30       end
31       license.boosts 'post'
32       license.save!
33     end
34   end
35
36   def down
37   end
38 end