动态表添加索引

This commit is contained in:
huang 2016-03-25 11:13:42 +08:00
parent ff2340baf9
commit 5fd3e7d3a2
4 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,5 @@
class AddIndexToForgeActivities < ActiveRecord::Migration
def change
add_index :forge_activities, [:project_id, :forge_act_id, :created_at]
add_index :forge_activities, [:project_id, :forge_act_id, :created_at, :forge_act_type], :name => "forge_act_index"
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToCourseActiivities < ActiveRecord::Migration
def change
add_index :course_activities, [:course_id, :course_act_id, :course_act_type, :created_at], :name => "course_act_index"
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToUserActivities < ActiveRecord::Migration
def change
add_index :user_activities, [:act_id, :act_type, :container_id, :created_at], :name => "user_act_index"
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 => 20160324052634) do
ActiveRecord::Schema.define(:version => 20160325030423) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -405,6 +405,8 @@ ActiveRecord::Schema.define(:version => 20160324052634) do
t.datetime "updated_at", :null => false
end
add_index "course_activities", ["course_id", "course_act_id", "course_act_type", "created_at"], :name => "course_act_index"
create_table "course_attachments", :force => true do |t|
t.string "filename"
t.string "disk_filename"
@ -731,6 +733,7 @@ ActiveRecord::Schema.define(:version => 20160324052634) do
end
add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id"
add_index "forge_activities", ["project_id", "forge_act_id", "created_at", "forge_act_type"], :name => "forge_act_index"
create_table "forge_messages", :force => true do |t|
t.integer "user_id"
@ -1812,6 +1815,8 @@ ActiveRecord::Schema.define(:version => 20160324052634) do
t.integer "user_id"
end
add_index "user_activities", ["act_id", "act_type", "container_id", "created_at"], :name => "user_act_index"
create_table "user_extensions", :force => true do |t|
t.integer "user_id", :null => false
t.date "birthday"