Merge branch '15159-export-trustallcontent' into main. Closes #15159
[arvados.git] / services / api / db / migrate / 20190322174136_add_file_info_to_collection.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class AddFileInfoToCollection < ActiveRecord::Migration[4.2]
6   def up
7     add_column :collections, :file_count, :integer, default: 0, null: false
8     add_column :collections, :file_size_total, :integer, limit: 8, default: 0, null: false
9
10     puts "Collections now have two new columns, file_count and file_size_total."
11     puts "They were initialized with a zero value. If you are upgrading an Arvados"
12     puts "installation, please run the populate-file-info-columns-in-collections.rb"
13     puts "script to populate the columns. If this is a new installation, that is not"
14     puts "necessary."
15   end
16
17   def down
18     remove_column :collections, :file_count
19     remove_column :collections, :file_size_total
20   end
21 end