diff options
author | danielgrippi <danielgrippi@gmail.com> | 2011-07-08 22:28:17 +0400 |
---|---|---|
committer | Raphael Sofaer <raphael@joindiaspora.com> | 2011-07-12 02:00:48 +0400 |
commit | 2e15b6a61e44f0bdd98f7b25473164eb3f38ebae (patch) | |
tree | 1e84239fc974411c597b3fa3ddc58bfe6ed762e7 /db | |
parent | e59f49aace4a6e4ad695c5791768a4470be67c49 (diff) |
Likes in comments, cache counter disabled for now.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20110707234802_likes_on_comments.rb | 19 | ||||
-rw-r--r-- | db/schema.rb | 5 |
2 files changed, 22 insertions, 2 deletions
diff --git a/db/migrate/20110707234802_likes_on_comments.rb b/db/migrate/20110707234802_likes_on_comments.rb new file mode 100644 index 000000000..2df5e02c5 --- /dev/null +++ b/db/migrate/20110707234802_likes_on_comments.rb @@ -0,0 +1,19 @@ +class LikesOnComments < ActiveRecord::Migration + def self.up + add_column :likes, :target_type, :string, :null => false + add_column :likes, :target_id, :integer, :null => false + remove_column :posts, :likes_count + + execute <<SQL + UPDATE likes + SET target_type = 'Post' +SQL + end + + def self.down + add_column :posts, :likes_count, :integer + remove_column :likes, :target_type + rename_column :likes, :target_id, :post_id + add_index :likes, :post_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 536e3167e..e05d2feb8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110707221112) do +ActiveRecord::Schema.define(:version => 20110707234802) do create_table "aspect_memberships", :force => true do |t| t.integer "aspect_id", :null => false @@ -117,6 +117,8 @@ ActiveRecord::Schema.define(:version => 20110707221112) do t.text "parent_author_signature" t.datetime "created_at" t.datetime "updated_at" + t.string "target_type", :null => false + t.integer "target_id", :null => false end add_index "likes", ["author_id"], :name => "likes_author_id_fk" @@ -266,7 +268,6 @@ ActiveRecord::Schema.define(:version => 20110707221112) do t.string "actor_url" t.integer "objectId" t.string "status_message_guid" - t.integer "likes_count", :default => 0 end add_index "posts", ["author_id"], :name => "index_posts_on_person_id" |