Ruby on rails 从迁移文件中删除Rails 4.2不推荐
我将把我的应用程序迁移到Rails 5。因此,我现在正在执行删除所有Rails 4.2弃用的过程。我得到了下面的弃用警告Ruby on rails 从迁移文件中删除Rails 4.2不推荐,ruby-on-rails,migration,deprecation-warning,Ruby On Rails,Migration,Deprecation Warning,我将把我的应用程序迁移到Rails 5。因此,我现在正在执行删除所有Rails 4.2弃用的过程。我得到了下面的弃用警告 DEPRECATION WARNING: `#timestamps` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to pr
DEPRECATION WARNING: `#timestamps` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in up at
因为我所有的迁移文件都没有
null: false
对于“我的时间戳”字段,如何避免引发此不推荐?您可以安全地向迁移中的所有时间戳字段添加
null:false
。这将不会再次运行迁移。所有以前运行的迁移ID都存储在名为schema\u migrations
的数据库表中。只要此表包含相应的迁移id,简单文件修改将不会导致迁移重新运行。如果在所有迁移中向所有时间戳添加null:true
,不推荐将消失。这是否会再次运行我的迁移?或者siml更改它将影响我的数据库数据,因为我将要这样做,这也是生产环境吗?