From c0b6e399d87b44a38544ab7f7f5b0fe1151dab12 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 15 Aug 2014 15:33:45 -0400 Subject: [PATCH] FIX: handle deferred and disagreed post actions --- .../20140815191556_fix_post_actions_index_again.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 db/migrate/20140815191556_fix_post_actions_index_again.rb diff --git a/db/migrate/20140815191556_fix_post_actions_index_again.rb b/db/migrate/20140815191556_fix_post_actions_index_again.rb new file mode 100644 index 00000000000..1979cbb8a93 --- /dev/null +++ b/db/migrate/20140815191556_fix_post_actions_index_again.rb @@ -0,0 +1,11 @@ +class FixPostActionsIndexAgain < ActiveRecord::Migration + def change + remove_index "post_actions", name: "idx_unique_actions" + add_index "post_actions", + ["user_id", "post_action_type_id", + "post_id", "targets_topic"], + name: "idx_unique_actions", + unique: true, + where: 'deleted_at IS NULL AND disagreed_at IS NULL AND deferred_at IS NULL' + end +end