DEV: Drop search index on non-pm posts.

DEV: Drop search index on non-pm posts.

The problem with this index is that on sites with a high non-pm to pm posts ratio, the index is esstentially duplicating the existing index on PostSearchData#search_data. If the site is huge, the index ends up taking up more diskspace.

diff --git a/db/migrate/20200820232017_drop_idx_regular_post_search_data.rb b/db/migrate/20200820232017_drop_idx_regular_post_search_data.rb
new file mode 100644
index 0000000..c61920c
--- /dev/null
+++ b/db/migrate/20200820232017_drop_idx_regular_post_search_data.rb
@@ -0,0 +1,11 @@
+class DropIdxRegularPostSearchData < ActiveRecord::Migration[6.0]
+  def up
+    execute <<~SQL
+    DROP INDEX CONCURRENTLY IF EXISTS idx_regular_post_search_data
+    SQL
+  end
+
+  def down
+    raise ActiveRecord::IrreversibleMigration
+  end
+end
diff --git a/db/post_migrate/20200818084329_update_private_message_on_post_search_data.rb b/db/post_migrate/20200818084329_update_private_message_on_post_search_data.rb
index 225a4a4..cab2c49 100644
--- a/db/post_migrate/20200818084329_update_private_message_on_post_search_data.rb
+++ b/db/post_migrate/20200818084329_update_private_message_on_post_search_data.rb
@@ -34,13 +34,6 @@ class UpdatePrivateMessageOnPostSearchData < ActiveRecord::Migration[6.0]
   end
 
   def up
-
-    # must drop index cause we do not want an enormous amount of work done
-    # as we are changing data
-    execute <<~SQL
-     DROP INDEX CONCURRENTLY IF EXISTS idx_regular_post_search_data
-    SQL
-
     # Delete post_search_data of orphaned posts
     execute <<~SQL
     DELETE FROM post_search_data
@@ -69,11 +62,6 @@ class UpdatePrivateMessageOnPostSearchData < ActiveRecord::Migration[6.0]
       update_private_message_flag
       change_column_null(:post_search_data, :private_message, false)
     end
-
-    execute <<~SQL
-      CREATE INDEX CONCURRENTLY idx_regular_post_search_data
-       ON post_search_data USING GIN(search_data) WHERE NOT private_message
-    SQL
   end
 
   def down

GitHub sha: 87de8948