js111
js111

Reputation: 1314

PG Error trying to push rails db to heroku

I'm trying to push my rails db to heroku using: heroku run rake db:migrate and getting the following error:

=  ChangeDateFormatInMyTable: migrating ======================================
-- change_column(:users, :date_of_birth, :datetime)
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::Error: ERROR:  column "date_of_birth" cannot be cast to type "pg_catalog.timestamp"
: ALTER TABLE "users" ALTER COLUMN "date_of_birth" TYPE timestamp

Upvotes: 0

Views: 378

Answers (2)

Mazterkizh
Mazterkizh

Reputation: 11

Yes "Heroku run rake db:reset" definitely works. I have been having a similar problem

RemoveGirthFromProfile: migrating =========================================
-- remove_column(:profiles, :girth)
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::Error: ERROR:  column "girth" of relation "profiles" does not exist
: ALTER TABLE "profiles" DROP "girth"

but when i reseted the database it solve the application errors i was even having on heroku

Upvotes: 1

Dain
Dain

Reputation: 47

Try a heroku run rake db:reset

Often times with Heroku and my PG Database, I have to do resets when I have massively changed things.

Upvotes: 2

Related Questions