0

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
12
  • What is the current type of :date_of_birth? You may need to explicitly convert the current values in that column to the new type. Commented May 12, 2012 at 23:56
  • :datetime... even when i do a db reset before trying to push to heroku i get this error...@kwbeam Commented May 13, 2012 at 0:07
  • What is the contents of that specific migration? Commented May 13, 2012 at 0:10
  • Yeah, why are you issuing a change_column if it’s already a datetime? Showing the migration code for everything involving :date_of_birth would help. Commented May 13, 2012 at 0:11
  • Well i did several migrations changing the datatype in attempts to fix this problem (also changed the name from date_of_birth to dob).. the last being "change_column :users, :dob, :datetime" Commented May 13, 2012 at 0:12

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.