From 721a007779102df75494aaddec312e99649dfae7 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 17 Dec 2015 13:22:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E7=94=B1=E4=BA=8Ecourse?= =?UTF-8?q?=E3=80=81project=E4=B8=80=E5=BC=A0=E8=A1=A8=E8=80=8C=E5=BC=95?= =?UTF-8?q?=E8=B5=B7=E7=9A=84=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20151217051447_delete_valid_project.rb | 15 +++++++++++++++ db/schema.rb | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20151217051447_delete_valid_project.rb diff --git a/db/migrate/20151217051447_delete_valid_project.rb b/db/migrate/20151217051447_delete_valid_project.rb new file mode 100644 index 000000000..fd99ac08e --- /dev/null +++ b/db/migrate/20151217051447_delete_valid_project.rb @@ -0,0 +1,15 @@ +class DeleteValidProject < ActiveRecord::Migration + def up + projects = Project.where("project_type =?", 1) + begin + projects.each do |p| + p.delete + end + rescue => e + logger.error "Delete project failed ====>#{e}" + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 5f53dd5cf..27de276b1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151215070238) do +ActiveRecord::Schema.define(:version => 20151217051447) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false