Commit 59c6019c5929a7349aeba354395284bf9865d83f
Committed by
Rodrigo Souto
1 parent
49914a4d
Exists in
master
and in
26 other branches
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 | ... | ... |