Reputation: 357
I am new to RoR and am starting on the guide at http://guides.rubyonrails.org/getting_started.html .
When I run the command bin/rails db:migrate
, I get the error command db:migrate not recognized
But I am able to run the command bin/rake db:migrate
without any issues.
My question is : is there any difference between the two or can I just rest easy and use rake? Thanks!
Upvotes: 7
Views: 4778
Reputation: 61
Rails is framework.
Rake is a standalone Ruby utility that replaces the Unix utility ‘make’, and uses a ‘Rakefile’ and .rake files to build up a list of tasks. In Rails, Rake is used for common administration tasks, especially sophisticated ones that build off of each other.”
You can view more : https://www.tutorialspoint.com/ruby-on-rails/rails-and-rake.htm
Upvotes: 4
Reputation: 52357
It depends on version of Rails. Before Rails 5.0 it was
rake db:migrate
Starting from Rails 5.0 it is
rails db:migrate
From changelog:
One Rails Command instead of the split-brain setup between rake and rails, so now it’s
bin/rails db:migrate
instead ofbin/rake db:migrate
See changelog for full list of changes in Rails 5.
Upvotes: 18
Reputation: 30056
Which version of rails gem are you using? In rails 5 (the guide you linked is for rails 5) we use rails command for everything. Before rails 5 we used rake for db commands.
Upvotes: 2