about summary refs log tree commit diff
path: root/db/migrate/20200110072034_add_index_to_tsv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200110072034_add_index_to_tsv.rb')
-rw-r--r--db/migrate/20200110072034_add_index_to_tsv.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20200110072034_add_index_to_tsv.rb b/db/migrate/20200110072034_add_index_to_tsv.rb
new file mode 100644
index 000000000..d6b66c2d6
--- /dev/null
+++ b/db/migrate/20200110072034_add_index_to_tsv.rb
@@ -0,0 +1,15 @@
+class AddIndexToTsv < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def up
+    safety_assured do
+      execute 'CREATE INDEX CONCURRENTLY statuses_text_vector_idx ON statuses USING GIN(tsv)'
+    end
+  end
+
+  def down
+    safety_assured do
+      execute 'DROP INDEX statuses_text_vector_idx ON statuses'
+    end
+  end
+end