Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove length restriction on CustomField#name

Oliver Günthera8652d74832b
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index 2d121527635..c436235481b 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -49,7 +49,7 @@ class CustomField < ApplicationRecord
validates :custom_options,
presence: { message: ->(*) { I18n.t(:'activerecord.errors.models.custom_field.at_least_one_custom_option') } },
if: ->(*) { field_format == 'list' }
- validates :name, presence: true, length: { maximum: 30 }
+ validates :name, presence: true, length: { maximum: 256 }
validate :uniqueness_of_name_with_scope
diff --git a/db/migrate/20210628185054_extend_custom_field_name_length.rb b/db/migrate/20210628185054_extend_custom_field_name_length.rb
new file mode 100644
index 00000000000..4d4eac19806
--- /dev/null
+++ b/db/migrate/20210628185054_extend_custom_field_name_length.rb
@@ -0,0 +1,9 @@
+class ExtendCustomFieldNameLength < ActiveRecord::Migration[6.1]
+ def up
+ change_column :custom_fields, :name, :string, limit: nil
+ end
+
+ def down
+ change_column :custom_fields, :name, :string, limit: 30
+ end
+end