I am working on rubyRails project. In db folder it contains schema file, seed file and .sqlite3 file but this database is zero kb.I want create database using this schema or seed file. Any idea
Asked
Active
Viewed 425 times
1 Answers
1
For rails 4 and below use rake db:setup
which will run the schema, migrations and seed and setup your initial database.
For Rails 5 use rails in place of rake rails db:setup
For further information refer to this Q&A on Stack Overflow:
Difference between rake db:migrate db:reset and db:schema:load
-
Thanks for the reply.But when i run these command on Command Prompt with Ruby and Rails, its showing an error["C:\Sites>rake db:setup rake aborted! No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb) (See full trace by running task with --trace) C:\Sites>rails db:setup The system cannot find the path specified.] can you explain me why this error is showing? – Harry Nov 11 '16 at 05:14
-
have you installed rails or bundler? did you run bundle install? I assume you have a Gemfile in C:\Sites? – David Nov 11 '16 at 08:01
-
I have installed only rubymine and Yes, My project inside C:\Sites\. First, I need to install rails or bundler? – Harry Nov 11 '16 at 08:25
-
install bundler first and then you can just simply do `bundle install` from command line (i think) which should then install rails and all other gems - after that do the `db:setup`. I say 'i think' because I don't have any experience of doing this on Windows - hope this helps. – David Nov 11 '16 at 08:40
-
Thanks Henners66. I will try it. – Harry Nov 11 '16 at 09:41
-
I am getting this error after installing rail and bundle install etc ''rake aborted! On Migration: undefined method `to_sym' for nil:NilClass" c:/project name /Config/application/rb.:7:in
and c:/ Rakefile:4:in – Harry Nov 11 '16 at 13:01 -
you might be better off creating a new question regarding this, we are diverging wildly from the original question and you will get faster response if you ask the whole community - also it's very limited putting the necessary information in comments - you should post your application.rb along with the error message and a brief synopsis - e.g. setting up rails on a windows environment etc etc. – David Nov 11 '16 at 14:26