diaspora/db/migrate/20111018010003_add_back_indexes.rb
2011-10-17 18:21:12 -07:00

19 lines
798 B
Ruby

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, :string, :default => "Post", :null => false
change_column :comments, :commentable_type, :string, :default => "Post", :null => false
# reduce index size
end
end