class DeleteErrorMyshixunFromMyshxiuns < ActiveRecord::Migration[5.2] def change myshixuns = Myshixun.where("created_at > '2019-07-26 00:00:00' and repo_name is null") myshixuns.find_each do |myshixun| if myshixun.games.blank? puts("###########user_login: #{User.find(myshixun.user_id).login}") myshixun.destroy! end end end end