1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class IndexAllFilenames < ActiveRecord::Migration
7 ActiveRecord::Base.connection.execute 'ALTER TABLE collections ALTER COLUMN file_names TYPE text'
8 Collection.find_each(batch_size: 20) do |c|
9 ActiveRecord::Base.connection.execute "UPDATE collections
10 SET file_names = #{ActiveRecord::Base.connection.quote(c.manifest_files)}
11 WHERE uuid = #{ActiveRecord::Base.connection.quote(c.uuid)}
12 AND portable_data_hash = #{ActiveRecord::Base.connection.quote(c.portable_data_hash)}"
16 ActiveRecord::Base.connection.execute 'ALTER TABLE collections ALTER COLUMN file_names TYPE varchar(8192)'