From 383f7963180235378b9562c167dc92928a3855f3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 29 Jul 2019 18:07:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E9=94=99=E8=AF=AF=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0729095722_delete_error_myshixun_from_myshxiuns.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/migrate/20190729095722_delete_error_myshixun_from_myshxiuns.rb diff --git a/db/migrate/20190729095722_delete_error_myshixun_from_myshxiuns.rb b/db/migrate/20190729095722_delete_error_myshixun_from_myshxiuns.rb new file mode 100644 index 000000000..ef5b86975 --- /dev/null +++ b/db/migrate/20190729095722_delete_error_myshixun_from_myshxiuns.rb @@ -0,0 +1,11 @@ +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