0

How are you everyone?

I am 'STUCK' in rake migration -

The error message shows -

Migrating to AddDeviseToUsers (20130628040020) == AddDeviseToUsers: migrating =============================================== -- change_table(:users) rake aborted! An error has occurred, this and all later migrations canceled:

PG::Error: ERROR: relation "users" does not exist : ALTER TABLE "users" ADD COLUMN "email" character varying(255) DEFAULT '' NOT NULL/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:652:in exec' ... /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.12/lib/active_record/migration.rb:551:in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:179:in `block (2 levels) in ' Tasks: TOP => db:migrate (See full trace by running task with --trace) Optinovations-MacBook-Air:omrails Optinovation$ rake db: migrate rake aborted!

Don't know how to build task 'db:'

https://github.com/optinovation/omrails

Heroku logs:

2013-06-28T04:30:42.808951+00:00 heroku[api]: Starting process with command bundle exec rake db:migrate by [email protected] 2013-06-28T04:30:48.308515+00:00 heroku[run.8286]: Awaiting client 2013-06-28T04:30:48.353120+00:00 heroku[run.8286]: Starting process with command bundle exec rake db:migrate 2013-06-28T04:30:56.086242+00:00 heroku[run.8286]: State changed from up to complete 2013-06-28T04:30:56.078116+00:00 heroku[run.8286]: Process exited with status 1 2013-06-28T05:31:34.078443+00:00 heroku[web.1]: Idling 2013-06-28T05:31:36.753947+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2013-06-28T05:31:38.664799+00:00 heroku[web.1]: Process exited with status 0 2013-06-28T05:31:38.670876+00:00 heroku[web.1]: State changed from up to down

Help please!

2

1 Answer 1

0

I cloned your repo and it appears the problem is resulting because your User table already has columns for email and name.

In your db/schema.rb file, you can see the db schema is timestamped (:version => 20130627224008) which is earlier than the 2 pending migration timestamps. The schema.rb timestamp will update if/when the migrations are successful.

The point is that it appears you already have columns for email and name in the User table. Specifically look at lines #35 and #47 in your schema.rb.

The error thrown in the development environment that I saw when running rake:db migrate was, "SQLite3::SQLException: duplicate column name: email: ALTER TABLE "users" ADD "email".

I didn't try to push your app to production, but in my experience PostgreSQL (PG) and SQLite errors can be slightly different for the same issue.

4
  • Well, what to do next depends a bit more on the context of what you are trying to accomplish. I was able to start the app locally in development (rails s) and sign in, so I'm not certain these migrations are necessary. If you are having trouble getting your app to work in production (omrails.herokuapp.com), try running "heroku logs" and see what errors are being thrown.
    – mxs
    Jun 28, 2013 at 15:14
  • Mike, yes, I can run the app in local host but can't in heroku. I posted the heroku logs for your review in the original content - Jun 28, 2013 at 20:36
  • Hi Optinovation - I looked things further and noticed your app/db/schema.rb file shows three tables (installs, users, and views), but each of these tables has the same columns. Personally, I haven't done the OneMonthRails tutorial, but looking at the author's schema.rb at github.com/mattangriffel/omrails/blob/master/db/schema.rb, his db structure looks a bit different than yours. I might suggest you review your work so far relative to the tutorial instructions and see if you've accidentally diverged. Stay positive, this is the learning process.
    – mxs
    Jul 1, 2013 at 16:43
  • Optinovation - please consider reporting back once you get this resolved. I wish you good luck.
    – mxs
    Jul 12, 2013 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.