From 03388e11ab94dbeadc7d933922aa2586d772a731 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 8 Jan 2015 15:26:15 +1100 Subject: [PATCH] oops, migration was flipping --- .../20150108002354_add_liked_and_bookmarked_to_topic_user.rb | 2 +- spec/models/post_action_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/db/migrate/20150108002354_add_liked_and_bookmarked_to_topic_user.rb b/db/migrate/20150108002354_add_liked_and_bookmarked_to_topic_user.rb index cb368ece21c..2dcdd47314c 100644 --- a/db/migrate/20150108002354_add_liked_and_bookmarked_to_topic_user.rb +++ b/db/migrate/20150108002354_add_liked_and_bookmarked_to_topic_user.rb @@ -4,7 +4,7 @@ class AddLikedAndBookmarkedToTopicUser < ActiveRecord::Migration add_column :topic_users, :bookmarked, :boolean, default: false # likes and bookmarks PostActionType.types[:like] and :bookmark which should not be used in a migration - {liked: 1, bookmarked: 2}.each do |name, type| + {liked: 2, bookmarked: 1}.each do |name, type| execute "UPDATE topic_users SET #{name} = true WHERE EXISTS (SELECT 1 FROM post_actions pa diff --git a/spec/models/post_action_spec.rb b/spec/models/post_action_spec.rb index 3e779d3738b..b9d7b2fc869 100644 --- a/spec/models/post_action_spec.rb +++ b/spec/models/post_action_spec.rb @@ -151,6 +151,7 @@ describe PostAction do tu = TopicUser.get(post.topic, codinghorror) expect(tu.liked).to be true + expect(tu.bookmarked).to be false end