Add some indicies

This commit is contained in:
Raphael 2011-01-19 14:29:22 -08:00
parent e7a065a521
commit 2578ac15b6
2 changed files with 38 additions and 14 deletions

View file

@ -0,0 +1,29 @@
class AddIndicies < ActiveRecord::Migration
def self.up
add_index :comments, :person_id
add_index :invitations, :recipient_id
add_index :invitations, :aspect_id
add_index :notifications, :target_id
add_index :notifications, :recipient_id
add_index :posts, :status_message_id
add_index :posts, [:status_message_id, :pending]
add_index :posts, [:type, :pending, :id]
end
def self.down
remove_index :comments, :person_id
remove_index :invitations, :recipient_id
remove_index :invitations, :aspect_id
remove_index :notifications, :target_id
remove_index :notifications, :recipient_id
remove_index :posts, :status_message_id
remove_index :posts, [:status_message_id, :pending]
remove_index :posts, [:type, :pending, :id]
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110119060243) do
ActiveRecord::Schema.define(:version => 20110119221746) do
create_table "aspect_memberships", :force => true do |t|
t.integer "aspect_id"
@ -50,6 +50,7 @@ ActiveRecord::Schema.define(:version => 20110119060243) do
add_index "comments", ["guid"], :name => "index_comments_on_guid", :unique => true
add_index "comments", ["mongo_id"], :name => "index_comments_on_mongo_id"
add_index "comments", ["person_id"], :name => "index_comments_on_person_id"
add_index "comments", ["post_id"], :name => "index_comments_on_post_id"
create_table "contacts", :force => true do |t|
@ -66,19 +67,6 @@ ActiveRecord::Schema.define(:version => 20110119060243) do
add_index "contacts", ["user_id", "pending"], :name => "index_contacts_on_user_id_and_pending"
add_index "contacts", ["user_id", "person_id"], :name => "index_contacts_on_user_id_and_person_id", :unique => true
create_table "histories", :force => true do |t|
t.string "message"
t.string "username"
t.integer "item"
t.string "table"
t.integer "month", :limit => 2
t.integer "year", :limit => 8
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "histories", ["item", "table", "month", "year"], :name => "index_histories_on_item_and_table_and_month_and_year"
create_table "invitations", :force => true do |t|
t.text "message"
t.integer "sender_id"
@ -89,7 +77,9 @@ ActiveRecord::Schema.define(:version => 20110119060243) do
t.string "mongo_id"
end
add_index "invitations", ["aspect_id"], :name => "index_invitations_on_aspect_id"
add_index "invitations", ["mongo_id"], :name => "index_invitations_on_mongo_id"
add_index "invitations", ["recipient_id"], :name => "index_invitations_on_recipient_id"
add_index "invitations", ["sender_id"], :name => "index_invitations_on_sender_id"
create_table "mongo_aspect_memberships", :force => true do |t|
@ -304,6 +294,8 @@ ActiveRecord::Schema.define(:version => 20110119060243) do
end
add_index "notifications", ["mongo_id"], :name => "index_notifications_on_mongo_id"
add_index "notifications", ["recipient_id"], :name => "index_notifications_on_recipient_id"
add_index "notifications", ["target_id"], :name => "index_notifications_on_target_id"
add_index "notifications", ["target_type", "target_id"], :name => "index_notifications_on_target_type_and_target_id"
create_table "people", :force => true do |t|
@ -356,6 +348,9 @@ ActiveRecord::Schema.define(:version => 20110119060243) do
add_index "posts", ["guid"], :name => "index_posts_on_guid"
add_index "posts", ["mongo_id"], :name => "index_posts_on_mongo_id"
add_index "posts", ["person_id"], :name => "index_posts_on_person_id"
add_index "posts", ["status_message_id", "pending"], :name => "index_posts_on_status_message_id_and_pending"
add_index "posts", ["status_message_id"], :name => "index_posts_on_status_message_id"
add_index "posts", ["type", "pending", "id"], :name => "index_posts_on_type_and_pending_and_id"
add_index "posts", ["type"], :name => "index_posts_on_type"
create_table "profiles", :force => true do |t|