简体   繁体   English

PG错误尝试将rails db推送到heroku

[英]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: 我正在尝试使用以下方法将rails db推送到heroku:heroku run rake db:migrate并得到以下错误:

=  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

Try a heroku run rake db:reset 尝试一个heroku运行rake db:reset

Often times with Heroku and my PG Database, I have to do resets when I have massively changed things. 通常,使用Heroku和我的PG数据库时,当我进行了很多更改时,我必须进行重置。

Yes "Heroku run rake db:reset" definitely works. 是的,“ Heroku运行rake db:reset”绝对有效。 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 但是当我重置数据库时,它解决了我甚至在heroku上遇到的应用程序错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM