Raised maximum length of project names and identifiers to 255 and 100 respectively (#6446).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4402 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2010-11-14 12:33:14 +00:00
parent eaab2ede76
commit 8ef06826c3
4 changed files with 26 additions and 5 deletions

View File

@ -20,6 +20,9 @@ class Project < ActiveRecord::Base
STATUS_ACTIVE = 1
STATUS_ARCHIVED = 9
# Maximum length for project identifiers
IDENTIFIER_MAX_LENGTH = 100
# Specific overidden Activities
has_many :time_entry_activities
has_many :members, :include => [:user, :roles], :conditions => "#{User.table_name}.type='User' AND #{User.table_name}.status=#{User::STATUS_ACTIVE}"
@ -66,9 +69,9 @@ class Project < ActiveRecord::Base
validates_presence_of :name, :identifier
validates_uniqueness_of :identifier
validates_associated :repository, :wiki
validates_length_of :name, :maximum => 30
validates_length_of :name, :maximum => 255
validates_length_of :homepage, :maximum => 255
validates_length_of :identifier, :in => 1..20
validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
# donwcase letters, digits, dashes but not digits only
validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :if => Proc.new { |p| p.identifier_changed? }
# reserved words

View File

@ -2,16 +2,16 @@
<div class="box">
<!--[form:project]-->
<p><%= f.text_field :name, :required => true, :maxlength => 30 %><br /><em><%= l(:text_caracters_maximum, 30) %></em></p>
<p><%= f.text_field :name, :required => true, :size => 60 %></p>
<% unless @project.allowed_parents.compact.empty? %>
<p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p>
<% end %>
<p><%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %></p>
<p><%= f.text_field :identifier, :required => true, :disabled => @project.identifier_frozen?, :maxlength => 20 %>
<p><%= f.text_field :identifier, :required => true, :size => 60, :disabled => @project.identifier_frozen? %>
<% unless @project.identifier_frozen? %>
<br /><em><%= l(:text_length_between, :min => 1, :max => 20) %> <%= l(:text_project_identifier_info) %></em>
<br /><em><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info) %></em>
<% end %></p>
<p><%= f.text_field :homepage, :size => 60 %></p>
<p><%= f.check_box :is_public %></p>

View File

@ -0,0 +1,9 @@
class ChangeProjectsNameLimit < ActiveRecord::Migration
def self.up
change_column :projects, :name, :string, :limit => nil, :default => '', :null => false
end
def self.down
change_column :projects, :name, :string, :limit => 30, :default => '', :null => false
end
end

View File

@ -0,0 +1,9 @@
class ChangeProjectsIdentifierLimit < ActiveRecord::Migration
def self.up
change_column :projects, :identifier, :string, :limit => nil
end
def self.down
change_column :projects, :identifier, :string, :limit => 20
end
end