Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
fix: Fixed broken migration_command default
Browse files Browse the repository at this point in the history
Due to construction of the old migration command, in very rare scenarios
it could invoke the `db:setup` command despite the database being set.
This could wipe out the database with productional data. The fix
ensures, that either migration command or setup command are ran - never
both.

Resolves #58
  • Loading branch information
ajgon committed Nov 27, 2016
1 parent a55d317 commit 36cdb68
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@

default['defaults']['framework']['migrate'] = true
default['defaults']['framework']['migration_command'] =
'/usr/local/bin/bundle exec rake db:version > /dev/null 2>&1 ' \
'&& /usr/local/bin/bundle exec rake db:migrate || /usr/local/bin/bundle exec rake db:setup'
'if /usr/local/bin/bundle exec rake db:version > /dev/null 2>&1; ' \
'then /usr/local/bin/bundle exec rake db:migrate; ' \
'else /usr/local/bin/bundle exec rake db:setup; ' \
'fi'
default['defaults']['framework']['assets_precompile'] = true
default['defaults']['framework']['assets_precompilation_command'] = '/usr/local/bin/bundle exec rake assets:precompile'
default['defaults']['framework']['envs_in_console'] = false
Expand Down

0 comments on commit 36cdb68

Please sign in to comment.