projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '17170-container-shell'
[arvados.git]
/
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 35ee7eaf3ac2c977856dcf7a6146f03458550aa5..1c78b53be345d17ae7909a677513132fa33d27ac 100644
(file)
--- a/
services/api/db/migrate/20170706141334_json_collection_properties.rb
+++ b/
services/api/db/migrate/20170706141334_json_collection_properties.rb
@@
-1,8
+1,15
@@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
require './db/migrate/20161213172944_full_text_search_indexes'
require './db/migrate/20161213172944_full_text_search_indexes'
-class JsonCollectionProperties < ActiveRecord::Migration
+class JsonCollectionProperties < ActiveRecord::Migration
[4.2]
def up
def up
- ActiveRecord::Base.connection.execute 'DROP INDEX collections_full_text_search_idx'
+ # 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')
end
ActiveRecord::Base.connection.execute 'ALTER TABLE collections ALTER COLUMN properties TYPE jsonb USING properties::jsonb'
FullTextSearchIndexes.new.replace_index('collections')
end