lmiting the type column on share_visibilities and comments
This commit is contained in:
parent
4cae3e9d62
commit
f7e70f8d93
4 changed files with 12 additions and 16 deletions
|
|
@ -4,7 +4,7 @@ class CommentAnything < ActiveRecord::Migration
|
|||
remove_index :comments, :post_id
|
||||
change_table :comments do |t|
|
||||
t.rename :post_id, :commentable_id
|
||||
t.string :commentable_type, :default => 'Post', :null => false
|
||||
t.string :commentable_type, :default => 'Post', :null => false, :limit => 60
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class ShareAnything < ActiveRecord::Migration
|
|||
#end
|
||||
|
||||
sql << "CHANGE COLUMN post_id shareable_id int NOT NULL"
|
||||
sql << "ADD shareable_type varchar(255) NOT NULL DEFAULT 'Post'"
|
||||
sql << "ADD shareable_type varchar(60) NOT NULL DEFAULT 'Post'"
|
||||
|
||||
#add_index :share_visibilities, [:shareable_id, :shareable_type, :contact_id], :name => 'shareable_and_contact_id'
|
||||
#add_index :share_visibilities, [:shareable_id, :shareable_type, :hidden, :contact_id], :name => 'shareable_and_hidden_and_contact_id'
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
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]
|
||||
|
|
@ -12,8 +10,6 @@ class AddBackIndexes < ActiveRecord::Migration
|
|||
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
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ ActiveRecord::Schema.define(:version => 20111018010003) do
|
|||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "likes_count", :default => 0, :null => false
|
||||
t.string "commentable_type", :default => "Post", :null => false
|
||||
t.string "commentable_type", :limit => 60, :default => "Post", :null => false
|
||||
end
|
||||
|
||||
add_index "comments", ["author_id"], :name => "index_comments_on_person_id"
|
||||
|
|
@ -369,7 +369,7 @@ ActiveRecord::Schema.define(:version => 20111018010003) do
|
|||
t.datetime "updated_at"
|
||||
t.boolean "hidden", :default => false, :null => false
|
||||
t.integer "contact_id", :null => false
|
||||
t.string "shareable_type", :default => "Post", :null => false
|
||||
t.string "shareable_type", :limit => 60, :default => "Post", :null => false
|
||||
end
|
||||
|
||||
add_index "share_visibilities", ["contact_id"], :name => "index_post_visibilities_on_contact_id"
|
||||
|
|
|
|||
Loading…
Reference in a new issue