【发布时间】:2013-09-20 00:04:52
【问题描述】:
这是我在尝试运行heroku run rake db:migrate时得到的结果
sender_id 是 string
== ChangeTypeToInteger: migrating ============================================
-- change_column(:messages, :sender_id, :integer)
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::Error: ERROR: column "sender_id" cannot be cast automatically to type integer
HINT: Specify a USING expression to perform the conversion.
: ALTER TABLE "messages" ALTER COLUMN "sender_id" TYPE integer/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/postgresql_adapter.rb:652:in `exec'
【问题讨论】:
-
这似乎是这个问题的欺骗:stackoverflow.com/questions/12603498/…
-
我的开发数据库是 sqlite ,我想如果我在 sqlite3 的迁移文件中使用它会出错
-
出于这样的原因,我强烈建议您不要在不同的环境中使用不同的数据库
标签: ruby-on-rails heroku ruby-on-rails-3.2