0

How to do? I tried something like:

RAILS_ENV=production rake db:create db:load

in file /lib/tasks/load_tasks.rake and this file I tried in terminal as rake db:migrate, but I am getting errors about syntax etc.

I entered into terminal this command (I saw it in tutorial):

rails generate scaffold Account user_name:string description:text premium:boolean \
      income:integer ranking:float fee:decimal birthday:date login_time:time

And this made me file 20110518181941_create_accounts.rb

How can I create database table - I thought the command above will create me database in mysql... I am now a bit confusing, what to do?

Which rule is playing here rake db:migrate?

1
  • yes, and I am getting error: pastebin.com/xNFmvjZm But I don't know, what is wrong... :/ Commented May 18, 2011 at 22:09

1 Answer 1

2

I think you are getting this error because your syntax is wrong, please put && between sentences:

RAILS_ENV=production rake db:create && db:schema:load

or do it in separated lines

RAILS_ENV=production rake db:create
RAILS_ENV=production rake db:schema:load

the first command will create the database, the second command will Load the db/schema.rb file into the database

And finally you need to run your migration:

RAILS_ENV=production rake db:migrate

to create your Accounts table.

BTW if you run:

rake -T

you can see the list of rake tasks and their descriptions.

Hope this helps.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks a lot for your reply JCorcuera. I tried to edit my code under your hints, but I am getting error about syntax - pastebin.com/2gyd6NNH. The arrow show the place, where is problem - I copied the error from terminal
I think you are doing db:load but is db:schema:load; and the commandi is rake -T not -t
@user705586: You're supposed to run RAILS_ENV=production rake db:create and RAILS_ENV=production rake db:schema:load from the shell command line, your error looks like you have them in a .rake file.
Yes, of course these two lines are in task.rake, I read this commands must be in a file, that have suffix .rake... I am a bit confused - what is right? Well, I would like to ask you how to run these two commands from terminal... I am newbie. Thanks in advance!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.