Merge branch '18767-filename-search-doc' refs #18767
[arvados.git] / services / api / db / migrate / 20170216170823_no_cr_mounts_and_workflow_def_in_full_text_search_index.rb
index 3d4a6062b49cc13d656ec732b7397d648f402c38..2d641c1729d11d4416dc171dd5fa57082cecefce 100644 (file)
@@ -1,4 +1,8 @@
-class NoCrMountsAndWorkflowDefInFullTextSearchIndex < ActiveRecord::Migration
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class NoCrMountsAndWorkflowDefInFullTextSearchIndex < ActiveRecord::Migration[4.2]
   def fts_indexes
     {
       "container_requests" => "container_requests_full_text_search_idx",
@@ -22,7 +26,13 @@ class NoCrMountsAndWorkflowDefInFullTextSearchIndex < ActiveRecord::Migration
 
   def down
     fts_indexes.each do |t, i|
-      remove_index t.to_sym, :name => i
+      t.classify.constantize.reset_column_information
+      ActiveRecord::Base.connection.indexes(t).each do |idx|
+        if idx.name == i
+          remove_index t.to_sym, :name => i
+          break
+        end
+      end
     end
   end
 end