[英]Rails 3, migration works locally, does not work in Heroku?
I recently posted this question 我最近发布了这个问题
which worked locally with the answer I selected as correct, here is the migration I used essentially: 在我选择的答案是正确的本地工作,这是我基本上使用的迁移:
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
After running heroku rake db:migrate, I received this error: 运行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)
Any ideas? 有任何想法吗?
Here is the work around I found on SO! 这是我在SO上找到的工作!
I would migrate back, delete the field, create the new field. 我会迁移回来,删除字段,创建新字段。
I did this plenty of times, worked like a charm. 我做了很多次,像一个魅力。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.