X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/5be901f5813fe9d026e2aa2a6a65d4ea4da4a001..88a29cd091468feb98e5cd541c560f4d35bca716:/services/api/db/migrate/20170706141334_json_collection_properties.rb diff --git a/services/api/db/migrate/20170706141334_json_collection_properties.rb b/services/api/db/migrate/20170706141334_json_collection_properties.rb index 55ab0df4dd..003e5fb092 100644 --- a/services/api/db/migrate/20170706141334_json_collection_properties.rb +++ b/services/api/db/migrate/20170706141334_json_collection_properties.rb @@ -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')