From 452766badeba09858562298014bfec11596b98c3 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 30 Sep 2015 09:58:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5=E7=9A=84?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=8E=92=E5=BA=8F=E6=97=B6=E9=97=B4=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...150930011457_alter_user_activities_news.rb | 18 ++++++++ db/schema.rb | 43 ++++++++----------- 2 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 db/migrate/20150930011457_alter_user_activities_news.rb diff --git a/db/migrate/20150930011457_alter_user_activities_news.rb b/db/migrate/20150930011457_alter_user_activities_news.rb new file mode 100644 index 000000000..169ac6795 --- /dev/null +++ b/db/migrate/20150930011457_alter_user_activities_news.rb @@ -0,0 +1,18 @@ +class AlterUserActivitiesNews < ActiveRecord::Migration + def up + UserActivity.all.each do |activity| + if activity.act_type = 'News' + if activity.act + activity.created_at = activity.act.created_on + activity.updated_at = activity.act.updated_on ? activity.act.updated_on : activity.act.created_on + activity.save + else + activity.destroy + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 205f3140c..9da8cdd66 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 => 20150928090128) do +ActiveRecord::Schema.define(:version => 20150930011457) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -476,13 +476,6 @@ ActiveRecord::Schema.define(:version => 20150928090128) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -497,26 +490,23 @@ ActiveRecord::Schema.define(:version => 20150928090128) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "enabled_modules", :force => true do |t| @@ -921,6 +911,7 @@ ActiveRecord::Schema.define(:version => 20150928090128) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" + t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id"