Merge branch '13330-intermediates-test' of git.curoverse.com:arvados into 13330-cwl...
[arvados.git] / services / api / db / migrate / 20170216170823_no_cr_mounts_and_workflow_def_in_full_text_search_index.rb
index 3d4a6062b49cc13d656ec732b7397d648f402c38..d4e13c9dd8d9e2d680be5b111ed6099dea9e30e9 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 class NoCrMountsAndWorkflowDefInFullTextSearchIndex < ActiveRecord::Migration
   def fts_indexes
     {
@@ -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