解决方法
我在维护的遗留应用程序中遇到了这个问题.有一些观察者正在干扰迁移到某一点,所以我通过检查应用程序名称和参数在迁移期间禁用它们
# Activate observers that should always be running # config.active_record.observers = :cacher,:garbage_collector,:forum_observer# observers break a migrate from VERSION xxx - disable them for rake db:migrate unless ( File.basename($0) == "rake" && ARGV.include?("db:migrate") ) config.active_record.observers = :user_observer end