11908: Migrate collections.properties to jsonb.
[arvados.git] / services / api / db / migrate / 20170706141334_json_collection_properties.rb
1 require './db/migrate/20161213172944_full_text_search_indexes'
2
3 class JsonCollectionProperties < ActiveRecord::Migration
4   def up
5     ActiveRecord::Base.connection.execute 'DROP INDEX collections_full_text_search_idx'
6     ActiveRecord::Base.connection.execute 'ALTER TABLE collections ALTER COLUMN properties TYPE jsonb USING properties::jsonb'
7     FullTextSearchIndexes.new.replace_index('collections')
8   end
9
10   def down
11     ActiveRecord::Base.connection.execute 'ALTER TABLE collections ALTER COLUMN properties TYPE text'
12   end
13 end