删除 由于course、project一张表而引起的历史数据异常问题

This commit is contained in:
huang 2015-12-17 13:22:41 +08:00
parent 074d8f62c2
commit 721a007779
2 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -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