diff --git a/db/migrate/20111018010003_add_back_indexes.rb b/db/migrate/20111018010003_add_back_indexes.rb new file mode 100644 index 0000000000000000000000000000000000000000..dcd13a6c05921fc475ab1bb65e721fcff4b7826b --- /dev/null +++ b/db/migrate/20111018010003_add_back_indexes.rb @@ -0,0 +1,18 @@ +class AddBackIndexes < ActiveRecord::Migration + def self.up + # reduce index size + change_column :comments, :commentable_type, :string, :default => "Post", :null => false, :length => 60 + change_column :share_visibilities, :shareable_type, :string, :default => "Post", :null => false, :length => 60 + + add_index :photos, :status_message_guid + add_index :comments, [:commentable_id, :commentable_type] + end + + def self.down + remove_index :comments, :column => [:commentable_id, :commentable_type] + remove_index :photos, :column => :status_message_guid + + change_column :share_visibilities, :shareable_type + change_column :comments, :commentable_type + end +end diff --git a/db/schema.rb b/db/schema.rb index 19eec1a2a93636fe3223cc7e284c7443a453382c..093e8357205b333248505aa04bf5b86de5925414 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20111012215141) do +ActiveRecord::Schema.define(:version => 20111018010003) do create_table "aspect_memberships", :force => true do |t| t.integer "aspect_id", :null => false @@ -62,6 +62,7 @@ ActiveRecord::Schema.define(:version => 20111012215141) do end add_index "comments", ["author_id"], :name => "index_comments_on_person_id" + add_index "comments", ["commentable_id", "commentable_type"], :name => "index_comments_on_commentable_id_and_commentable_type" add_index "comments", ["guid"], :name => "index_comments_on_guid", :unique => true create_table "contacts", :force => true do |t| @@ -262,6 +263,8 @@ ActiveRecord::Schema.define(:version => 20111012215141) do t.integer "comments_count" end + add_index "photos", ["status_message_guid"], :name => "index_photos_on_status_message_guid" + create_table "pods", :force => true do |t| t.string "host" t.boolean "ssl"