14285: Merge branch 'master' into 14285-keep-balance-metrics
[arvados.git] / services / api / db / migrate / 20170706141334_json_collection_properties.rb
index 55ab0df4dda72ee32d43f5ffec6f1c41e1a327b9..921803a2970137c89cf8e19c8fdd329061f09c1c 100644 (file)
@@ -1,7 +1,14 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require './db/migrate/20161213172944_full_text_search_indexes'
 
 class JsonCollectionProperties < ActiveRecord::Migration
   def up
+    # Drop the FT index before changing column type to avoid
+    # "PG::DatatypeMismatch: ERROR: COALESCE types jsonb and text
+    # cannot be matched".
     ActiveRecord::Base.connection.execute 'DROP INDEX IF EXISTS collections_full_text_search_idx'
     ActiveRecord::Base.connection.execute 'ALTER TABLE collections ALTER COLUMN properties TYPE jsonb USING properties::jsonb'
     FullTextSearchIndexes.new.replace_index('collections')