3

What is the difference between for example using

rails db:migrate

and

bundle exec rake db:migrate

when using the rails framework? It seems to do the same for me...

Robstaa
  • 85
  • 7
  • https://stackoverflow.com/questions/6588674/what-does-bundle-exec-rake-mean gives a pretty good answer of what adding `bundle exec` does. :) – msmith1114 Feb 15 '18 at 16:45
  • 1
    Possible duplicate of [What does bundle exec rake mean?](https://stackoverflow.com/questions/6588674/what-does-bundle-exec-rake-mean) – msmith1114 Feb 15 '18 at 16:45

2 Answers2

5

Two fold. As of rails 5 you can substitute rails and rake for db:migrate. What you are really changing is adding bundle exec which is telling it to execute the rake from the application's bundler instead of your platform bundler.

For instance, you have bundler v15 on your mac, and bundler v12 on the application. bundle exec rake will use bundler v12, but rake will use bundler v15.

David Weber
  • 354
  • 1
  • 12
1
rails db:migrate vs bundle exec rake db:migrate

Internally rails is proxying commands to rake.

See this link

Prince Bansal
  • 286
  • 2
  • 5