11908: Add comment about dropping/recreating FT index.
authorTom Clegg <tom@curoverse.com>
Tue, 11 Jul 2017 15:14:01 +0000 (11:14 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Thu, 7 Dec 2017 15:24:37 +0000 (10:24 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curoverse.com>

services/api/db/migrate/20170706141334_json_collection_properties.rb

index 55ab0df4dda72ee32d43f5ffec6f1c41e1a327b9..003e5fb0929edfa490e4be82383f2ca7e0b75acb 100644 (file)
@@ -2,6 +2,9 @@ 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')