我需要在生产环境中使用这种方法时要小心谨慎! 喜欢:
def remove_column(...)
raise 'You will delete data with column !' if Rails.env.production?
[... normal code ...]
end
答案 0 :(得分:0)
我没有测试过这个,但也许是这样的?
module ActiveRecord
module ConnectionAdapters
module SchemaStatements
include ActiveRecord::Migration::JoinTable
def remove_column(...)
raise 'You will delete data with column !' if Rails.env.production?
super
end
end
end
end