0

我正在尝试使用以下命令将我的 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
4

2 回答 2

2

尝试 heroku run rake db:reset

经常使用 Heroku 和我的 PG 数据库时,当我进行大量更改时,我必须进行重置。

于 2012-05-13T03:35:33.600 回答
1

是的,“Heroku run rake db:reset”绝对有效。我一直有类似的问题

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"

但是当我重置数据库时,它解决了我什至在 heroku 上遇到的应用程序错误

于 2012-11-10T14:46:58.470 回答