Reputation: 3100
I am currently developing a Rails app which uses PostgreSQL in both development and production. I began development on my laptop but now I want to begin development on a new desktop (both use Ubuntu as the OS). I committed all changes on the laptop, git cloned on the desktop, installed the required gems, installed PostgreSQL, and did a rake db:create and migrate. However, I'm still getting database errors that I do not see when I run the app on my laptop.
For example:
ActiveRecord::StatementInvalid in UsersController#show
PG::Error: ERROR: column works.user_id does not exist
LINE 1: SELECT "works".* FROM "works" WHERE "works"."user_id" = 1
^
: SELECT "works".* FROM "works" WHERE "works"."user_id" = 1
It seems as if the SQL syntax contains added quotes that do not belong there. Again, this error does not occur on my laptop.
The database.yml file is setup correctly:
development:
adapter: postgresql
encoding: unicode
database: app_development
pool: 5
username: bruce
I never developed the app using sqlite so I'm not sure why I'm getting these strange errors. Did I miss a step when I git cloned my repo on my new dev machine?
Thanks!
Upvotes: 2
Views: 73
Reputation: 718
PostgreSQL tells you he misses a user_id column, so you must launch rake db:migrate
Check your two db/schema.rb
in your environment. Open a console on your first environment and ensure that the works table has a user_id attribute.
Upvotes: 5