Merge branch '12690-12748-crunchstat-summary'
[arvados.git] / services / api / db / migrate / 20141208174553_descriptions_are_strings.rb
index b33a49a4463119b00e79d4548c0d3f6b5878625d..554474d33ddd2d6a6f64a02d61cddefacdc81582 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 class DescriptionsAreStrings < ActiveRecord::Migration
   def tables_with_description_column
     %w{collections groups jobs pipeline_instances pipeline_templates}
@@ -5,13 +9,15 @@ class DescriptionsAreStrings < ActiveRecord::Migration
 
   def up
     tables_with_description_column.each do |table|
-      change_column table.to_sym, :description, :string, :limit => 10000
+      change_column table.to_sym, :description, :string, :limit => 2**19
     end
   end
 
   def down
     tables_with_description_column.each do |table|
-      if table != 'collections'
+      if table == 'collections'
+        change_column table.to_sym, :description, :string # implicit limit 255
+      else
         change_column table.to_sym, :description, :text
       end
     end