Reputation: 5084
I am learning Ruby on Rails, an am getting an error creating the database. I run the following command from console:
rake db:create db:migrate db:seed
And get:
== 20140328232600 AddAuthLevelToUser: migrating ===============================
-- add_column(:users, :auth_level, :Integer)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "users" does not exist
I looked at the error message on the webpage, and tried running:
'bin/rake db:migrate RAILS_ENV=development'
As suggested, but had little luck.
The project I am working on had been started by another team of developers, so I pulled it off git... Any suggestions?
Cheers
Upvotes: 0
Views: 288
Reputation: 53048
As per the error, you are running the migration AddAuthLevelToUser
when you don't even have users
table in database.
Firstly, verify if you have migration for users
table, if not then create one.
If yes, then check that migration for users
table has a VERSION NUMBER lower than that of AddAuthLevelToUser
. Fix it and run the migrations.
Upvotes: 3
Reputation: 11638
Try running just rake db:create
at first. What database is your project using? Work this out and use the database client to connect to the database on your local system, and verify whether the users table exists on the database. It's possible that the db:create job is not correctly creating all the tables necessary for the database schema.
Upvotes: 1