Rake or Rails db:migrate
Asked Answered
S

3

7

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!

Snowman answered 10/10, 2016 at 9:22 Comment(0)
T
18

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 of bin/rake db:migrate

See changelog for full list of changes in Rails 5.

Turbo answered 10/10, 2016 at 9:24 Comment(0)
G
4

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

Gavel answered 10/10, 2016 at 9:59 Comment(0)
R
2

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.

Rote answered 10/10, 2016 at 9:25 Comment(1)
I am using rails 4.2.5.. hm I should update my rails version then.. thanks!Snowman

© 2022 - 2024 — McMap. All rights reserved.