Error When Doing Rake Db:Migrate on Heroku

Heroku rake db:migrate error

It could be about your firewall issues.

Heroku docs states that: -

Timeout awaiting process The heroku run command opens a connection to
Heroku on port 5000. If your local network or ISP is blocking port
5000, or you are experiencing a connectivity issue, you will see an
error similar to: $ heroku run rails console Running rails console
attached to terminal... Timeout awaiting process You can test your
connection to Heroku by trying to connect directly to
rendezvous.runtime.heroku.com on port 5000 using telnet. A successful
session will look like this: $ telnet rendezvous.runtime.heroku.com
5000 Trying 50.19.103.36... Connected to
ec2-50-19-103-36.compute-1.amazonaws.com. Escape character is '^]'. If
you do not get this output, your computer is being blocked from
accessing our services. We recommend contacting your IT department,
ISP, or firewall manufacturer to move forward with this issue.

You can do a heroku run and then do a telnet rendezvous.runtime.heroku.com 5000 to see if your computer is blocking the connection.

I run heroku run rake db:migrate but I got error PG::UndefinedColumn: ERROR: column user_id of relation tasks does not exist

I already solved this.

I just deleted the file that is causing the error, there's a migration file I created to remove the user_id from task table. Rails assuming that the user_id clumn as been removed or not existing because of the migration file.

Error with heroku run rake db:migrate

Your previous migrations are missing.

You can do:

rake db:create
rake db:schema:load
rake db:migrate

Which will recreate your database based on your schema.rb file.

PG::Undefinedtable: ERROR: when run rake db:migrate on Heroku

I would drop the database on heroku and recreate it(You will loose all data saved to the db):

    heroku pg:reset DATABASE_URL --confirm your_app_name

Replace your_app_name with the app name on heroku, but leave DATABASE_URL as it is.

Then run:

    heroku run rake db:setup

It will run both of these commands:

    heroku run rake db:migrate 
heroku run rake db:seed

And you should be set.



Related Topics



Leave a reply



Submit