diff --git a/db/migrate/20111011194702_comment_anything.rb b/db/migrate/20111011194702_comment_anything.rb index 1af52245ce08f786f7610ccdff8e3a111c0c9eaf..d79da4afd82beb8b45eba858ef9413cfadd3a00d 100644 --- a/db/migrate/20111011194702_comment_anything.rb +++ b/db/migrate/20111011194702_comment_anything.rb @@ -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 diff --git a/db/migrate/20111011195702_share_anything.rb b/db/migrate/20111011195702_share_anything.rb index b02dfdc9467bafbdfa1ef2226640fdf124804642..ef59656a5ffcbc2d95f90a0564291f1b0d376bb1 100644 --- a/db/migrate/20111011195702_share_anything.rb +++ b/db/migrate/20111011195702_share_anything.rb @@ -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' diff --git a/db/migrate/20111018010003_add_back_indexes.rb b/db/migrate/20111018010003_add_back_indexes.rb index cfc3f9c4cab2a3027bda598b162e3e84a16d7f1c..878cc526a3e7ca219b88c8f807aaad537a58b5b0 100644 --- a/db/migrate/20111018010003_add_back_indexes.rb +++ b/db/migrate/20111018010003_add_back_indexes.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 093e8357205b333248505aa04bf5b86de5925414..a017f8512063cf7c8093bd06d13cdde8f5a895dd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -48,17 +48,17 @@ ActiveRecord::Schema.define(:version => 20111018010003) do add_index "aspects", ["user_id"], :name => "index_aspects_on_user_id" create_table "comments", :force => true do |t| - t.text "text", :null => false - t.integer "commentable_id", :null => false - t.integer "author_id", :null => false - t.string "guid", :null => false + t.text "text", :null => false + t.integer "commentable_id", :null => false + t.integer "author_id", :null => false + t.string "guid", :null => false t.text "author_signature" t.text "parent_author_signature" t.text "youtube_titles" 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.integer "likes_count", :default => 0, :null => false + t.string "commentable_type", :limit => 60, :default => "Post", :null => false end 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" 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 "updated_at" - t.boolean "hidden", :default => false, :null => false - t.integer "contact_id", :null => false - t.string "shareable_type", :default => "Post", :null => false + t.boolean "hidden", :default => false, :null => false + t.integer "contact_id", :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"