问题描述
class RemovesConversationClass < ActiveRecord::Migration[5.2]
def up
ConversationClass.where("created_at > ")destroy_all
end
def down
raise ActiveRecord::IrreversibleMigration
end
end
解决方法
你可以有这样的时间Time.new(2021,9,7)
ConversationClass.where("created_at > ?",Time.new(2021,7)).destroy_all
应该可以。但在生产环境中使用之前,您应该先在开发环境中对其进行测试。