删除空数据
This commit is contained in:
parent
c2efb7bdda
commit
90a9472e30
|
@ -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
|
21
db/schema.rb
21
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"
|
||||
|
|
Loading…
Reference in New Issue