OSDN Git Service

fix:element remove func failed
[pettanr/pettanr.git] / db / migrate / 20140612222717_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         balloon.boosts 'post'
9       end
10       balloon.save!
11     end
12     Speech.find_each do |speech|
13       sbt = speech.speech_balloon.speech_balloon_template
14       if speech.speech_balloon_template_module_name == 'noname'
15         speech.speech_balloon_template_id = sbt.id
16         speech.speech_balloon_template_module_name = sbt.module_name
17       end
18       wf =  speech.writing_format
19       if speech.writing_format_module_name == 'noname'
20         speech.writing_format_module_name = wf.module_name
21       end
22       speech.boosts 'post'
23       speech.save!
24     end
25     License.find_each do |license|
26       lg = license.license_group
27       if license.license_group_module_name == 'noname'
28         license.license_group_module_name = lg.module_name
29       end
30       license.boosts 'post'
31       license.save!
32     end
33   end
34
35   def down
36   end
37 end