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
|
remove_index :comments, :post_id
|
||||||
change_table :comments do |t|
|
change_table :comments do |t|
|
||||||
t.rename :post_id, :commentable_id
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class ShareAnything < ActiveRecord::Migration
|
||||||
#end
|
#end
|
||||||
|
|
||||||
sql << "CHANGE COLUMN post_id shareable_id int NOT NULL"
|
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, :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'
|
#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
|
class AddBackIndexes < ActiveRecord::Migration
|
||||||
def self.up
|
def self.up
|
||||||
# reduce index size
|
# 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 :photos, :status_message_guid
|
||||||
add_index :comments, [:commentable_id, :commentable_type]
|
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 :comments, :column => [:commentable_id, :commentable_type]
|
||||||
remove_index :photos, :column => :status_message_guid
|
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
|
# reduce index size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
20
db/schema.rb
20
db/schema.rb
|
|
@ -48,17 +48,17 @@ ActiveRecord::Schema.define(:version => 20111018010003) do
|
||||||
add_index "aspects", ["user_id"], :name => "index_aspects_on_user_id"
|
add_index "aspects", ["user_id"], :name => "index_aspects_on_user_id"
|
||||||
|
|
||||||
create_table "comments", :force => true do |t|
|
create_table "comments", :force => true do |t|
|
||||||
t.text "text", :null => false
|
t.text "text", :null => false
|
||||||
t.integer "commentable_id", :null => false
|
t.integer "commentable_id", :null => false
|
||||||
t.integer "author_id", :null => false
|
t.integer "author_id", :null => false
|
||||||
t.string "guid", :null => false
|
t.string "guid", :null => false
|
||||||
t.text "author_signature"
|
t.text "author_signature"
|
||||||
t.text "parent_author_signature"
|
t.text "parent_author_signature"
|
||||||
t.text "youtube_titles"
|
t.text "youtube_titles"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "likes_count", :default => 0, :null => false
|
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
|
end
|
||||||
|
|
||||||
add_index "comments", ["author_id"], :name => "index_comments_on_person_id"
|
add_index "comments", ["author_id"], :name => "index_comments_on_person_id"
|
||||||
|
|
@ -364,12 +364,12 @@ ActiveRecord::Schema.define(:version => 20111018010003) do
|
||||||
add_index "services", ["user_id"], :name => "index_services_on_user_id"
|
add_index "services", ["user_id"], :name => "index_services_on_user_id"
|
||||||
|
|
||||||
create_table "share_visibilities", :force => true do |t|
|
create_table "share_visibilities", :force => true do |t|
|
||||||
t.integer "shareable_id", :null => false
|
t.integer "shareable_id", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.boolean "hidden", :default => false, :null => false
|
t.boolean "hidden", :default => false, :null => false
|
||||||
t.integer "contact_id", :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
|
end
|
||||||
|
|
||||||
add_index "share_visibilities", ["contact_id"], :name => "index_post_visibilities_on_contact_id"
|
add_index "share_visibilities", ["contact_id"], :name => "index_post_visibilities_on_contact_id"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue