Commit 67e1f2201a5c32376166c4aa2b70d6705b523e19
1 parent
5d9e7a5f
Exists in
design_template
Migrate for add the fourth box.
Migrate for add the fourth box to existing enviroments and profiles. Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
db/migrate/20150423144533_add_block_to_environment_and_profile.rb
0 → 100644
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +class AddBlockToEnvironmentAndProfile < ActiveRecord::Migration | |
| 2 | + def up | |
| 3 | + Environment.all.each do |env| | |
| 4 | + env.boxes << Box.new if env.boxes.count < 4 | |
| 5 | + end | |
| 6 | + | |
| 7 | + Profile.all.each do |profile| | |
| 8 | + profile.boxes << Box.new if profile.boxes.count < 4 | |
| 9 | + end | |
| 10 | + end | |
| 11 | + | |
| 12 | + def down | |
| 13 | + say "this migration can't be reverted" | |
| 14 | + end | |
| 15 | +end | ... | ... |