【发布时间】:2014-02-15 08:08:15
【问题描述】:
目前,如果books 表没有created_at 或updated_at 字段,则当前迁移可能会失败:
class AddTimestampIndexes < ActiveRecord::Migration
def up
remove_index :books, :created_at
remove_index :books, :updated_at
add_index :books, :created_at
add_index :books, :updated_at
end
def down
remove_index :books, :created_at
remove_index :books, :updated_at
end
end
如果remove_index 未能删除索引而不是引发错误,它是否会采取任何选项静默继续?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 rails-migrations