From 90a9472e304c25cf8e46b135be3d58183ad0d61c Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 13 May 2016 20:07:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=A9=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60513120002_delete_empty_apply_homework.rb | 18 ++++++++++++++++ db/schema.rb | 21 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20160513120002_delete_empty_apply_homework.rb diff --git a/db/migrate/20160513120002_delete_empty_apply_homework.rb b/db/migrate/20160513120002_delete_empty_apply_homework.rb new file mode 100644 index 000000000..b270582b1 --- /dev/null +++ b/db/migrate/20160513120002_delete_empty_apply_homework.rb @@ -0,0 +1,18 @@ +class DeleteEmptyApplyHomework < ActiveRecord::Migration + def up + count = ApplyHomework.all.count / 30 + 2 + transaction do + for i in 1 ... count do i + ApplyHomework.page(i).per(30).each do |ah| + homework = HomeworkCommon.find ah.homework_common_id + if homework.nil? + ah.destroy + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index d5334c43c..092252062 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 => 20160511055221) do +ActiveRecord::Schema.define(:version => 20160513120002) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1107,6 +1107,23 @@ ActiveRecord::Schema.define(:version => 20160511055221) do t.integer "viewed_count", :default => 0 end + create_table "mess", :id => false, :force => true do |t| + t.string "课程名" + t.integer "课程ID", :default => 0, :null => false + t.string "教师姓", :default => "", :null => false + t.string "教师名", :limit => 30, :default => "", :null => false + t.string "主贴名", :default => "", :null => false + t.integer "主贴或回帖ID", :default => 0, :null => false + t.integer "回帖对应主贴ID" + t.integer "帖子点赞数" + t.integer "主贴回复数", :default => 0, :null => false + t.text "主贴或回帖内容" + t.datetime "发帖时间", :null => false + t.integer "发帖或回帖用户ID", :default => 0, :null => false + t.string "发帖或回帖用户姓", :default => "", :null => false + t.string "发帖或回帖用户名", :limit => 30, :default => "", :null => false + end + create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" @@ -1328,6 +1345,7 @@ ActiveRecord::Schema.define(:version => 20160511055221) do t.boolean "allow_guest_download", :default => true t.integer "visits", :default => 0 t.integer "show_mode", :default => 0 + t.integer "allow_teacher", :default => 0 end create_table "phone_app_versions", :force => true do |t| @@ -2043,6 +2061,7 @@ ActiveRecord::Schema.define(:version => 20160511055221) do t.string "salt", :limit => 64 t.integer "gid" t.integer "visits", :default => 0 + t.integer "excellent_teacher", :default => 0 end add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"