By Tintin
Hi,
I followed this tutorial to deploy my first Rails app on Ubuntu / Nginx / Unicorn: https://www.digitalocean.com/community/articles/how-to-launch-your-ruby-on-rails-app-with-the-digitalocean-one-click-image
However, in my Rails production log I see this:
E, [2014-05-24T11:48:34.711858 #13238] ERROR – : Mysql2::Error: Table ‘rails.users’ doesn’t exist: SELECT users.* FROM users WHERE users.remember_token IS NULL LIMIT 1
I, [2014-05-24T11:48:34.712349 #13238] INFO – : Completed 500 Internal Server Error in 48ms
When I take a closer look at my “rails” database I can see that it contains only one table (“schema_migrations”) where there should be more than a dozen.
Running commands like
RAILS_ENV=production rake db:migrate
or
RAILS_ENV=production rake db:create db:schema:load
seems to have no effect on the database. But strangely I don’t get any error messages when running those commands.
How can I create the database for my app from schema.rb?
Thanks for any help.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Your rake commands need to be the first on the line. The Rails environment goes at the end. The way you have done it, you have set the Rails environment variable to “production rake db:create db:schema:load”. That’s why it doesn’t complain. You can set the environment variable to anything you want, whether it makes sense or not.
Let me revise that. You can do it the way you have it, but make sure you put a semicolon after the Rails environment.
<br>RAILS_ENV=production; rake db:create db:schema:load
<br>They are two separate commands.
Thanks a lot for your help. But actually that doesn’t change much. It still won’t create my database.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.