Merge branch '8784-dir-listings'
[arvados.git] / services / api / db / migrate / 20141208174553_descriptions_are_strings.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class DescriptionsAreStrings < ActiveRecord::Migration
6   def tables_with_description_column
7     %w{collections groups jobs pipeline_instances pipeline_templates}
8   end
9
10   def up
11     tables_with_description_column.each do |table|
12       change_column table.to_sym, :description, :string, :limit => 2**19
13     end
14   end
15
16   def down
17     tables_with_description_column.each do |table|
18       if table == 'collections'
19         change_column table.to_sym, :description, :string # implicit limit 255
20       else
21         change_column table.to_sym, :description, :text
22       end
23     end
24   end
25 end