小编Chr*_*eys的帖子

为什么这种迁移不可逆转?(change_table,rename,text)

我认为这是一个非常简单的迁移.出于某种原因,IrreversibleMigration当我尝试db:rollback或时,我收到错误db:migrate:redo.

迁移顺利进行,但我宁愿保持可逆.我无法弄清楚为什么它不像书面那样.有任何想法吗?

这是迁移:

class AddWhyHypAndWhyHypeToStatements < ActiveRecord::Migration
  def change
    change_table :statements do |t|
      t.rename :description, :why_hypocritical
      t.text   :why_hypothetical
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

如果重要,"description"列是文本列.我正在使用Rails 3.1/Ruby 1.9.2/PostgreSQL.谢谢你的帮助.

migration activerecord ruby-on-rails

23
推荐指数
1
解决办法
4401
查看次数

标签 统计

activerecord ×1

migration ×1

ruby-on-rails ×1