gpt4 book ai didi

ruby-on-rails - Rails 3,迁移在本地有效,在 Heroku 中不起作用?

转载 作者:行者123 更新时间:2023-12-04 03:46:46 24 4
gpt4 key购买 nike

我最近发布了 this question

在本地工作,我选择的答案是正确的,这里是我主要使用的迁移:

class ChangeColumnToUsers < ActiveRecord::Migration
def self.up
change_column :users, :created_at, :datetime

end

def self.down
change_column :users, :created_at, :string
end
end

运行 heroku rake db:migrate 后,我收到此错误:

rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR: column "deadline" cannot be cast to type "date"
: ALTER TABLE "tasks" ALTER COLUMN "deadline" TYPE date

(See full trace by running task with --trace)
(in /disk1/home/slugs/18c5c920-2e22-40f5-8d6a-b20a0fc5d7ba/mnt)
== ChangeColumnToUsers: migrating ============================================
-- change_column(:users, :created_at, :datetime)

有什么想法吗?

最佳答案

这是我在 SO 上找到的解决方法!

How do I change column type in Heroku?

关于ruby-on-rails - Rails 3,迁移在本地有效,在 Heroku 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4670710/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com