Skip to content
Extraits de code Groupes Projets
Valider 38d685e0 rédigé par danielgrippi's avatar danielgrippi
Parcourir les fichiers

add proper index to comments

parent b4620022
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
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
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended to check this file into your version control system. # 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| create_table "aspect_memberships", :force => true do |t|
t.integer "aspect_id", :null => false t.integer "aspect_id", :null => false
...@@ -62,6 +62,7 @@ ActiveRecord::Schema.define(:version => 20111012215141) do ...@@ -62,6 +62,7 @@ ActiveRecord::Schema.define(:version => 20111012215141) do
end end
add_index "comments", ["author_id"], :name => "index_comments_on_person_id" 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 add_index "comments", ["guid"], :name => "index_comments_on_guid", :unique => true
create_table "contacts", :force => true do |t| create_table "contacts", :force => true do |t|
...@@ -262,6 +263,8 @@ ActiveRecord::Schema.define(:version => 20111012215141) do ...@@ -262,6 +263,8 @@ ActiveRecord::Schema.define(:version => 20111012215141) do
t.integer "comments_count" t.integer "comments_count"
end end
add_index "photos", ["status_message_guid"], :name => "index_photos_on_status_message_guid"
create_table "pods", :force => true do |t| create_table "pods", :force => true do |t|
t.string "host" t.string "host"
t.boolean "ssl" t.boolean "ssl"
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter