From 52547466f0f1ce8b41bf1539546aaa28457077a1 Mon Sep 17 00:00:00 2001
From: Jean-Philippe Lang
Date: Wed, 25 Apr 2007 15:06:20 +0000
Subject: [PATCH] Fixed: 10342 Creation of Schema in Oracle Comment is a
reserved keyword for Oracle. The five 'Comment' columns are renamed to
'Commments'. Migration scripts were modified to let oracle users create the
database. For the others, migration 41 will rename the columns (only if
columns have the 'old' name). Fixed also a few oracle specific issues.
Note: currently (in Rails 1.2.3), there's bug in Rails oracle adapter. See: http://dev.rubyonrails.org/ticket/7344
Attached patch is required for redMine to work properly.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@479 e93f8b46-1217-0410-a6f0-8f06a7374b81
---
app/controllers/projects_controller.rb | 6 +++---
app/controllers/timelog_controller.rb | 4 ++--
app/controllers/wiki_controller.rb | 6 +++---
app/helpers/application_helper.rb | 2 ++
app/models/changeset.rb | 4 ++--
app/models/comment.rb | 2 +-
app/models/custom_value.rb | 2 +-
app/models/repository.rb | 2 +-
app/models/time_entry.rb | 4 ++--
app/models/user_preference.rb | 9 +++++++--
app/views/news/show.rhtml | 6 +++---
app/views/projects/activity.rhtml | 4 ++--
app/views/projects/search.rhtml | 2 +-
app/views/projects/show.rhtml | 2 +-
app/views/repositories/_revisions.rhtml | 4 ++--
app/views/repositories/revision.rhtml | 2 +-
app/views/timelog/details.rhtml | 4 ++--
app/views/timelog/edit.rhtml | 2 +-
app/views/wiki/edit.rhtml | 2 +-
app/views/wiki/history.rhtml | 4 ++--
app/views/wiki/show.rhtml | 2 +-
config/environments/test_oracle.rb | 2 +-
db/migrate/010_create_comments.rb | 2 +-
db/migrate/029_create_wiki_contents.rb | 4 ++--
db/migrate/032_create_time_entries.rb | 2 +-
db/migrate/034_create_changesets.rb | 2 +-
db/migrate/041_rename_comment_to_comments.rb | 13 +++++++++++++
lang/de.yml | 2 +-
lang/en.yml | 2 +-
lang/es.yml | 2 +-
lang/fr.yml | 2 +-
lang/it.yml | 2 +-
lang/ja.yml | 2 +-
lang/pt.yml | 2 +-
lang/zh.yml | 2 +-
test/fixtures/changesets.yml | 8 ++++----
test/fixtures/comments.yml | 2 +-
test/fixtures/wiki_content_versions.yml | 6 +++---
test/fixtures/wiki_contents.yml | 2 +-
test/unit/comment_test.rb | 2 +-
test/unit/wiki_content_test.rb | 4 ++--
41 files changed, 80 insertions(+), 60 deletions(-)
create mode 100644 db/migrate/041_rename_comment_to_comments.rb
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 19f93de9..c94810aa 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -503,7 +503,7 @@ class ProjectsController < ApplicationController
end
unless params[:show_wiki_edits] == "0"
- select = "#{WikiContent.versioned_table_name}.updated_on, #{WikiContent.versioned_table_name}.comment, " +
+ select = "#{WikiContent.versioned_table_name}.updated_on, #{WikiContent.versioned_table_name}.comments, " +
"#{WikiContent.versioned_table_name}.#{WikiContent.version_column}, #{WikiPage.table_name}.title"
joins = "LEFT JOIN #{WikiPage.table_name} ON #{WikiPage.table_name}.id = #{WikiContent.versioned_table_name}.page_id " +
"LEFT JOIN #{Wiki.table_name} ON #{Wiki.table_name}.id = #{WikiPage.table_name}.wiki_id "
@@ -624,7 +624,7 @@ class ProjectsController < ApplicationController
# no more than 5 tokens to search for
@tokens.slice! 5..-1 if @tokens.size > 5
# strings used in sql like statement
- like_tokens = @tokens.collect {|w| "%#{w}%"}
+ like_tokens = @tokens.collect {|w| "%#{w.downcase}%"}
operator = @all_words ? " AND " : " OR "
limit = 10
@results = []
@@ -632,7 +632,7 @@ class ProjectsController < ApplicationController
@results += @project.news.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort], :include => :author ) if @scope.include? 'news'
@results += @project.documents.find(:all, :limit => limit, :conditions => [ (["(LOWER(title) like ? OR LOWER(description) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @scope.include? 'documents'
@results += @project.wiki.pages.find(:all, :limit => limit, :include => :content, :conditions => [ (["(LOWER(title) like ? OR LOWER(text) like ?)"] * like_tokens.size).join(operator), * (like_tokens * 2).sort] ) if @project.wiki && @scope.include?('wiki')
- @results += @project.repository.changesets.find(:all, :limit => limit, :conditions => [ (["(LOWER(comment) like ?)"] * like_tokens.size).join(operator), * (like_tokens).sort] ) if @project.repository && @scope.include?('changesets')
+ @results += @project.repository.changesets.find(:all, :limit => limit, :conditions => [ (["(LOWER(comments) like ?)"] * like_tokens.size).join(operator), * (like_tokens).sort] ) if @project.repository && @scope.include?('changesets')
@question = @tokens.join(" ")
else
@question = ""
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index 5902390d..c07a7606 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -59,7 +59,7 @@ private
l(:field_activity),
l(:field_issue),
l(:field_hours),
- l(:field_comment)
+ l(:field_comments)
]
csv << headers.collect {|c| ic.iconv(c) }
# csv lines
@@ -69,7 +69,7 @@ private
entry.activity.name,
(entry.issue ? entry.issue.id : nil),
entry.hours,
- entry.comment
+ entry.comments
]
csv << fields.collect {|c| ic.iconv(c.to_s) }
end
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 5931a93a..9e750b3a 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -47,7 +47,7 @@ class WikiController < ApplicationController
@content = @page.content_for_version(params[:version])
@content.text = "h1. #{@page.pretty_title}" if @content.text.blank?
# don't keep previous comment
- @content.comment = nil
+ @content.comments = nil
if request.post?
if @content.text == params[:content][:text]
# don't save if text wasn't changed
@@ -55,7 +55,7 @@ class WikiController < ApplicationController
return
end
@content.text = params[:content][:text]
- @content.comment = params[:content][:comment]
+ @content.comments = params[:content][:comments]
@content.author = logged_in_user
# if page is new @page.save will also save content, but not if page isn't a new record
if (@page.new_record? ? @page.save : @content.save)
@@ -69,7 +69,7 @@ class WikiController < ApplicationController
@page = @wiki.find_page(params[:page])
# don't load text
@versions = @page.content.versions.find :all,
- :select => "id, author_id, comment, updated_on, version",
+ :select => "id, author_id, comments, updated_on, version",
:order => 'version DESC'
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 2583116c..ed068a75 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -113,6 +113,8 @@ module ApplicationHelper
# textilize text according to system settings and RedCloth availability
def textilizable(text, options = {})
+ return "" if text.blank?
+
# different methods for formatting wiki links
case options[:wiki_links]
when :local
diff --git a/app/models/changeset.rb b/app/models/changeset.rb
index 824fa12f..2038266f 100644
--- a/app/models/changeset.rb
+++ b/app/models/changeset.rb
@@ -34,7 +34,7 @@ class Changeset < ActiveRecord::Base
end
def scan_comment_for_issue_ids
- return if comment.blank?
+ return if comments.blank?
# keywords used to reference issues
ref_keywords = Setting.commit_ref_keywords.downcase.split(",")
# keywords used to fix issues
@@ -48,7 +48,7 @@ class Changeset < ActiveRecord::Base
# remove any associated issues
self.issues.clear
- comment.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match|
+ comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match|
action = match[0]
target_issue_ids = match[1].scan(/\d+/)
target_issues = repository.project.issues.find_all_by_id(target_issue_ids)
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 27e5c511..88d5348d 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -19,5 +19,5 @@ class Comment < ActiveRecord::Base
belongs_to :commented, :polymorphic => true, :counter_cache => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
- validates_presence_of :commented, :author, :comment
+ validates_presence_of :commented, :author, :comments
end
diff --git a/app/models/custom_value.rb b/app/models/custom_value.rb
index a1b2c9c4..e12c1437 100644
--- a/app/models/custom_value.rb
+++ b/app/models/custom_value.rb
@@ -22,7 +22,7 @@ class CustomValue < ActiveRecord::Base
protected
def validate
errors.add(:value, :activerecord_error_blank) and return if custom_field.is_required? and value.empty?
- errors.add(:value, :activerecord_error_invalid) unless custom_field.regexp.empty? or value =~ Regexp.new(custom_field.regexp)
+ errors.add(:value, :activerecord_error_invalid) unless custom_field.regexp.blank? or value =~ Regexp.new(custom_field.regexp)
errors.add(:value, :activerecord_error_too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length and value.length > 0
errors.add(:value, :activerecord_error_too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length
case custom_field.field_format
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 5b7feb79..02dfda6b 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -62,7 +62,7 @@ class Repository < ActiveRecord::Base
:revision => revision.identifier,
:committer => revision.author,
:committed_on => revision.time,
- :comment => revision.message)
+ :comments => revision.message)
revision.paths.each do |change|
Change.create(:changeset => changeset,
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index 984c2c3a..c37f5dc8 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -10,7 +10,7 @@ class TimeEntry < ActiveRecord::Base
validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on
validates_numericality_of :hours, :allow_nil => true
- validates_length_of :comment, :maximum => 255
+ validates_length_of :comments, :maximum => 255
def before_validation
self.project = issue.project if issue && project.nil?
@@ -28,6 +28,6 @@ class TimeEntry < ActiveRecord::Base
super
self.tyear = spent_on ? spent_on.year : nil
self.tmonth = spent_on ? spent_on.month : nil
- self.tweek = spent_on ? spent_on.cweek : nil
+ self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil
end
end
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index d9601d51..1ed9e0fd 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -26,11 +26,15 @@ class UserPreference < ActiveRecord::Base
self.others ||= {}
end
+ def before_save
+ self.others ||= {}
+ end
+
def [](attr_name)
if attribute_present? attr_name
super
else
- others[attr_name]
+ others ? others[attr_name] : nil
end
end
@@ -38,7 +42,8 @@ class UserPreference < ActiveRecord::Base
if attribute_present? attr_name
super
else
- others.store attr_name, value
+ self.others ||= {}
+ self.others.store attr_name, value
end
end
end
diff --git a/app/views/news/show.rhtml b/app/views/news/show.rhtml
index 024bd00f..30e746ae 100644
--- a/app/views/news/show.rhtml
+++ b/app/views/news/show.rhtml
@@ -19,14 +19,14 @@
<%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy_comment', :id => @news, :comment_id => comment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
- <%= simple_format(auto_link(h comment.comment))%>
+ <%= simple_format(auto_link(h comment.comments))%>
<% end if @news.comments_count > 0 %>
<% if authorize_for 'news', 'add_comment' %>
-<%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comment" %>
+<%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %>
<% form_tag({:action => 'add_comment', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %>
-<%= text_area 'comment', 'comment', :cols => 60, :rows => 6 %>
+<%= text_area 'comment', 'comments', :cols => 60, :rows => 6 %>
<%= submit_tag l(:button_add) %>
<% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml
index a0d41988..0ade2335 100644
--- a/app/views/projects/activity.rhtml
+++ b/app/views/projects/activity.rhtml
@@ -39,10 +39,10 @@
<%= e.created_on.strftime("%H:%M") %> <%=l(:label_document)%>: <%= link_to h(e.title), :controller => 'documents', :action => 'show', :id => e %>
<% elsif e.is_a? WikiContent.versioned_class %>
<%= e.created_on.strftime("%H:%M") %> <%=l(:label_wiki_edit)%>: <%= link_to h(WikiPage.pretty_title(e.title)), :controller => 'wiki', :page => e.title %> (<%= link_to '#' + e.version.to_s, :controller => 'wiki', :page => e.title, :version => e.version %>)
- <% unless e.comment.blank? %><%=h e.comment %><% end %>
+ <% unless e.comments.blank? %><%=h e.comments %><% end %>
<% elsif e.is_a? Changeset %>
<%= e.created_on.strftime("%H:%M") %> <%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %>
- <%=h e.committer.blank? ? "anonymous" : e.committer %><%= h(": #{truncate(e.comment, 500)}") unless e.comment.blank? %>
+ <%=h e.committer.blank? ? "anonymous" : e.committer %><%= h(": #{truncate(e.comments, 500)}") unless e.comments.blank? %>
<% end %>
diff --git a/app/views/projects/search.rhtml b/app/views/projects/search.rhtml
index 7f2998e7..d13302b6 100644
--- a/app/views/projects/search.rhtml
+++ b/app/views/projects/search.rhtml
@@ -41,7 +41,7 @@
<%= e.content.author ? e.content.author.name : "Anonymous" %>, <%= format_time(e.content.updated_on) %>
<% elsif e.is_a? Changeset %>
<%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %>
- <%= highlight_tokens(e.comment, @tokens) %>
+ <%= highlight_tokens(e.comments, @tokens) %>
<%= e.committer.blank? ? e.committer : "Anonymous" %>, <%= format_time(e.committed_on) %>
<% end %>
diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml
index c8f109ea..2afeb825 100644
--- a/app/views/projects/show.rhtml
+++ b/app/views/projects/show.rhtml
@@ -7,7 +7,7 @@
<%= textilizable @project.description %>
- <% unless @project.homepage.empty? %>- <%=l(:field_homepage)%>: <%= auto_link @project.homepage %>
<% end %>
+ <% unless @project.homepage.blank? %>- <%=l(:field_homepage)%>: <%= auto_link @project.homepage %>
<% end %>
- <%=l(:field_created_on)%>: <%= format_date(@project.created_on) %>
<% unless @project.parent.nil? %>
- <%=l(:field_parent)%>: <%= link_to @project.parent.name, :controller => 'projects', :action => 'show', :id => @project.parent %>
diff --git a/app/views/repositories/_revisions.rhtml b/app/views/repositories/_revisions.rhtml
index a7dfbb66..c297b5d0 100644
--- a/app/views/repositories/_revisions.rhtml
+++ b/app/views/repositories/_revisions.rhtml
@@ -3,7 +3,7 @@
# |
<%= l(:label_date) %> |
<%= l(:field_author) %> |
-<%= l(:field_comment) %> |
+<%= l(:field_comments) %> |
|
@@ -12,7 +12,7 @@
<%= link_to changeset.revision, :action => 'revision', :id => project, :rev => changeset.revision %> |
<%= format_time(changeset.committed_on) %> |
<%=h changeset.committer %> |
-<%= textilizable(changeset.comment) %> |
+<%= textilizable(changeset.comments) %> |
<%= link_to l(:label_view_diff), :action => 'diff', :id => project, :path => path, :rev => changeset.revision if entry && entry.is_file? && changeset != changesets.last %> |
<% end %>
diff --git a/app/views/repositories/revision.rhtml b/app/views/repositories/revision.rhtml
index b443e8c6..4fa8bd20 100644
--- a/app/views/repositories/revision.rhtml
+++ b/app/views/repositories/revision.rhtml
@@ -8,7 +8,7 @@
<%= l(:label_revision) %> <%= @changeset.revision %>
<%= @changeset.committer %>, <%= format_time(@changeset.committed_on) %>
-<%= textilizable @changeset.comment %>
+<%= textilizable @changeset.comments %>
<% if @changeset.issues.any? %>
<%= l(:label_related_issues) %>
diff --git a/app/views/timelog/details.rhtml b/app/views/timelog/details.rhtml
index f85eb0f5..4ceca97b 100644
--- a/app/views/timelog/details.rhtml
+++ b/app/views/timelog/details.rhtml
@@ -16,7 +16,7 @@
<%= sort_header_tag('user_id', :caption => l(:label_member)) %>
<%= sort_header_tag('activity_id', :caption => l(:label_activity)) %>
<%= sort_header_tag('issue_id', :caption => l(:label_issue)) %>
-<%= l(:label_comment) %> |
+<%= l(:label_comments) %> |
<%= sort_header_tag('hours', :caption => l(:field_hours)) %>
|
@@ -36,7 +36,7 @@
<% end %>
-<%=h entry.comment %> |
+<%=h entry.comments %> |
<%= entry.hours %> |
<%= link_to_if_authorized(l(:button_edit), {:controller => 'timelog', :action => 'edit', :id => entry}, :class => "icon icon-edit") if entry.user_id == @owner_id %> |
diff --git a/app/views/timelog/edit.rhtml b/app/views/timelog/edit.rhtml
index b826f7be..13d76f1e 100644
--- a/app/views/timelog/edit.rhtml
+++ b/app/views/timelog/edit.rhtml
@@ -7,7 +7,7 @@
<%= f.text_field :issue_id, :size => 6 %> <%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %>
<%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %>
<%= f.text_field :hours, :size => 6, :required => true %>
-<%= f.text_field :comment, :size => 100 %>
+<%= f.text_field :comments, :size => 100 %>
<%= f.select :activity_id, (@activities.collect {|p| [p.name, p.id]}), :required => true %>
diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml
index 0bc6322f..af0b24df 100644
--- a/app/views/wiki/edit.rhtml
+++ b/app/views/wiki/edit.rhtml
@@ -12,7 +12,7 @@
:onclick => "window.open('#{ url_for :controller => 'help', :ctrl => 'wiki', :page => 'syntax' }', '', 'resizable=yes, location=no, width=300, height=500, menubar=no, status=no, scrollbars=yes'); return false;" %>
<%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit' %>
-
<%= f.text_field :comment, :size => 120 %>
+
<%= f.text_field :comments, :size => 120 %>
<%= submit_tag l(:button_save) %>
<%= link_to_remote l(:label_preview),
{ :url => { :controller => 'wiki', :action => 'preview', :id => @project, :page => @page.title },
diff --git a/app/views/wiki/history.rhtml b/app/views/wiki/history.rhtml
index dd9e590b..78dc70cc 100644
--- a/app/views/wiki/history.rhtml
+++ b/app/views/wiki/history.rhtml
@@ -11,7 +11,7 @@
# |
<%= l(:field_updated_on) %> |
<%= l(:field_author) %> |
- <%= l(:field_comment) %> |
+ <%= l(:field_comments) %> |
<% @versions.each do |ver| %>
@@ -19,7 +19,7 @@
<%= link_to ver.version, :action => 'index', :page => @page.title, :version => ver.version %> |
<%= format_time(ver.updated_on) %> |
<%= ver.author ? ver.author.name : "anonyme" %> |
- <%=h ver.comment %> |
+ <%=h ver.comments %> |
<% end %>
diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml
index e4e1bc38..a65b1a61 100644
--- a/app/views/wiki/show.rhtml
+++ b/app/views/wiki/show.rhtml
@@ -13,7 +13,7 @@
<%= link_to(l(:label_current_version), :action => 'index', :page => @page.title) %>
<%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %>
- <%=h @content.comment %>
+ <%=h @content.comments %>
<% end %>
diff --git a/config/environments/test_oracle.rb b/config/environments/test_oracle.rb
index 35bb19be..0eb1cd6c 100644
--- a/config/environments/test_oracle.rb
+++ b/config/environments/test_oracle.rb
@@ -4,7 +4,7 @@
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
-config.cache_classes = true
+config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
diff --git a/db/migrate/010_create_comments.rb b/db/migrate/010_create_comments.rb
index d804140b..29e1116a 100644
--- a/db/migrate/010_create_comments.rb
+++ b/db/migrate/010_create_comments.rb
@@ -4,7 +4,7 @@ class CreateComments < ActiveRecord::Migration
t.column :commented_type, :string, :limit => 30, :default => "", :null => false
t.column :commented_id, :integer, :default => 0, :null => false
t.column :author_id, :integer, :default => 0, :null => false
- t.column :comment, :text
+ t.column :comments, :text
t.column :created_on, :datetime, :null => false
t.column :updated_on, :datetime, :null => false
end
diff --git a/db/migrate/029_create_wiki_contents.rb b/db/migrate/029_create_wiki_contents.rb
index fde2d22d..c5c9f2a4 100644
--- a/db/migrate/029_create_wiki_contents.rb
+++ b/db/migrate/029_create_wiki_contents.rb
@@ -4,7 +4,7 @@ class CreateWikiContents < ActiveRecord::Migration
t.column :page_id, :integer, :null => false
t.column :author_id, :integer
t.column :text, :text
- t.column :comment, :string, :limit => 255, :default => ""
+ t.column :comments, :string, :limit => 255, :default => ""
t.column :updated_on, :datetime, :null => false
t.column :version, :integer, :null => false
end
@@ -16,7 +16,7 @@ class CreateWikiContents < ActiveRecord::Migration
t.column :author_id, :integer
t.column :data, :binary
t.column :compression, :string, :limit => 6, :default => ""
- t.column :comment, :string, :limit => 255, :default => ""
+ t.column :comments, :string, :limit => 255, :default => ""
t.column :updated_on, :datetime, :null => false
t.column :version, :integer, :null => false
end
diff --git a/db/migrate/032_create_time_entries.rb b/db/migrate/032_create_time_entries.rb
index e055c13e..9b9a54eb 100644
--- a/db/migrate/032_create_time_entries.rb
+++ b/db/migrate/032_create_time_entries.rb
@@ -5,7 +5,7 @@ class CreateTimeEntries < ActiveRecord::Migration
t.column :user_id, :integer, :null => false
t.column :issue_id, :integer
t.column :hours, :float, :null => false
- t.column :comment, :string, :limit => 255
+ t.column :comments, :string, :limit => 255
t.column :activity_id, :integer, :null => false
t.column :spent_on, :date, :null => false
t.column :tyear, :integer, :null => false
diff --git a/db/migrate/034_create_changesets.rb b/db/migrate/034_create_changesets.rb
index a78c8e36..612fd46b 100644
--- a/db/migrate/034_create_changesets.rb
+++ b/db/migrate/034_create_changesets.rb
@@ -5,7 +5,7 @@ class CreateChangesets < ActiveRecord::Migration
t.column :revision, :integer, :null => false
t.column :committer, :string, :limit => 30
t.column :committed_on, :datetime, :null => false
- t.column :comment, :text
+ t.column :comments, :text
end
add_index :changesets, [:repository_id, :revision], :unique => true, :name => :changesets_repos_rev
end
diff --git a/db/migrate/041_rename_comment_to_comments.rb b/db/migrate/041_rename_comment_to_comments.rb
new file mode 100644
index 00000000..aedad002
--- /dev/null
+++ b/db/migrate/041_rename_comment_to_comments.rb
@@ -0,0 +1,13 @@
+class RenameCommentToComments < ActiveRecord::Migration
+ def self.up
+ rename_column(:comments, :comment, :comments) if ActiveRecord::Base.connection.columns("comments").detect{|c| c.name == "comment"}
+ rename_column(:wiki_contents, :comment, :comments) if ActiveRecord::Base.connection.columns("wiki_contents").detect{|c| c.name == "comment"}
+ rename_column(:wiki_content_versions, :comment, :comments) if ActiveRecord::Base.connection.columns("wiki_content_versions").detect{|c| c.name == "comment"}
+ rename_column(:time_entries, :comment, :comments) if ActiveRecord::Base.connection.columns("time_entries").detect{|c| c.name == "comment"}
+ rename_column(:changesets, :comment, :comments) if ActiveRecord::Base.connection.columns("changesets").detect{|c| c.name == "comment"}
+ end
+
+ def self.down
+ raise IrreversibleMigration
+ end
+end
diff --git a/lang/de.yml b/lang/de.yml
index 40122081..8785640f 100644
--- a/lang/de.yml
+++ b/lang/de.yml
@@ -139,7 +139,7 @@ field_start_date: Beginn
field_done_ratio: %% erledigt
field_auth_source: Authentifizierungs-Modus
field_hide_mail: Email Adresse nicht anzeigen
-field_comment: Kommentar
+field_comments: Kommentar
field_url: URL
field_start_page: Hauptseite
field_subproject: Subprojekt von
diff --git a/lang/en.yml b/lang/en.yml
index 2c1ea280..9e601625 100644
--- a/lang/en.yml
+++ b/lang/en.yml
@@ -139,7 +139,7 @@ field_start_date: Start
field_done_ratio: %% Done
field_auth_source: Authentication mode
field_hide_mail: Hide my email address
-field_comment: Comment
+field_comments: Comment
field_url: URL
field_start_page: Start page
field_subproject: Subproject
diff --git a/lang/es.yml b/lang/es.yml
index 12f52301..2453e232 100644
--- a/lang/es.yml
+++ b/lang/es.yml
@@ -139,7 +139,7 @@ field_start_date: Comienzo
field_done_ratio: %% Realizado
field_auth_source: Modo de la autentificación
field_hide_mail: Ocultar mi email address
-field_comment: Comentario
+field_comments: Comentario
field_url: URL
field_start_page: Página principal
field_subproject: Proyecto secundario
diff --git a/lang/fr.yml b/lang/fr.yml
index 68336f6f..cddf467a 100644
--- a/lang/fr.yml
+++ b/lang/fr.yml
@@ -139,7 +139,7 @@ field_start_date: Début
field_done_ratio: %% Réalisé
field_auth_source: Mode d'authentification
field_hide_mail: Cacher mon adresse mail
-field_comment: Commentaire
+field_comments: Commentaire
field_url: URL
field_start_page: Page de démarrage
field_subproject: Sous-projet
diff --git a/lang/it.yml b/lang/it.yml
index 0c12db67..42ff23f7 100644
--- a/lang/it.yml
+++ b/lang/it.yml
@@ -139,7 +139,7 @@ field_start_date: Inizio
field_done_ratio: %% completo
field_auth_source: Modalità di autenticazione
field_hide_mail: Nascondi il mio indirizzo di e-mail
-field_comment: Commento
+field_comments: Commento
field_url: URL
field_start_page: Pagina principale
field_subproject: Sottoprogetto
diff --git a/lang/ja.yml b/lang/ja.yml
index 82f430ea..10833b90 100644
--- a/lang/ja.yml
+++ b/lang/ja.yml
@@ -140,7 +140,7 @@ field_start_date: 開始日
field_done_ratio: 進捗 %%
field_auth_source: 認証モード
field_hide_mail: メールアドレスを隠す
-field_comment: コメント
+field_comments: コメント
field_url: URL
field_start_page: メインページ
field_subproject: サブプロジェクト
diff --git a/lang/pt.yml b/lang/pt.yml
index 8d3bb214..658872c1 100644
--- a/lang/pt.yml
+++ b/lang/pt.yml
@@ -139,7 +139,7 @@ field_start_date: Inicio
field_done_ratio: %% Terminado
field_auth_source: Modo de autenticacao
field_hide_mail: Esconder meu email
-field_comment: Comentario
+field_comments: Comentario
field_url: URL
field_start_page: Pagina inicial
field_subproject: Sub-projeto
diff --git a/lang/zh.yml b/lang/zh.yml
index 1b6556a8..e125310d 100644
--- a/lang/zh.yml
+++ b/lang/zh.yml
@@ -142,7 +142,7 @@ field_start_date: 开始
field_done_ratio: %% 完成
field_auth_source: 认证模式
field_hide_mail: 隐藏我的邮件
-field_comment: 注释
+field_comments: 注释
field_url: URL
field_start_page: 起始页
field_subproject: 子项目
diff --git a/test/fixtures/changesets.yml b/test/fixtures/changesets.yml
index 10adc5d8..1fb8ba64 100644
--- a/test/fixtures/changesets.yml
+++ b/test/fixtures/changesets.yml
@@ -4,7 +4,7 @@ changesets_001:
committed_on: 2007-04-11 15:14:44 +02:00
revision: 1
id: 100
- comment: My very first commit
+ comments: My very first commit
repository_id: 10
committer: dlopper
changesets_002:
@@ -12,7 +12,7 @@ changesets_002:
committed_on: 2007-04-12 15:14:44 +02:00
revision: 2
id: 101
- comment: 'This commit fixes #1, #2 and references #3'
+ comments: 'This commit fixes #1, #2 and references #3'
repository_id: 10
committer: dlopper
changesets_003:
@@ -20,7 +20,7 @@ changesets_003:
committed_on: 2007-04-12 15:14:44 +02:00
revision: 3
id: 102
- comment: |-
+ comments: |-
A commit with wrong issue ids
IssueID 666 3
repository_id: 10
@@ -30,7 +30,7 @@ changesets_004:
committed_on: 2007-04-12 15:14:44 +02:00
revision: 4
id: 103
- comment: |-
+ comments: |-
A commit with an issue id of an other project
IssueID 4 2
repository_id: 10
diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml
index 24a4546a..b60a68b8 100644
--- a/test/fixtures/comments.yml
+++ b/test/fixtures/comments.yml
@@ -4,7 +4,7 @@ comments_001:
commented_id: 1
id: 1
author_id: 1
- comment: my first comment
+ comments: my first comment
created_on: 2006-12-10 18:10:10 +01:00
updated_on: 2006-12-10 18:10:10 +01:00
\ No newline at end of file
diff --git a/test/fixtures/wiki_content_versions.yml b/test/fixtures/wiki_content_versions.yml
index 784b3b03..c433fc5d 100644
--- a/test/fixtures/wiki_content_versions.yml
+++ b/test/fixtures/wiki_content_versions.yml
@@ -5,7 +5,7 @@ wiki_content_versions_001:
id: 1
version: 1
author_id: 1
- comment: Page creation
+ comments: Page creation
wiki_content_id: 1
compression: ""
data: |-
@@ -18,7 +18,7 @@ wiki_content_versions_002:
id: 2
version: 2
author_id: 1
- comment: Small update
+ comments: Small update
wiki_content_id: 1
compression: ""
data: |-
@@ -31,7 +31,7 @@ wiki_content_versions_003:
id: 3
version: 3
author_id: 1
- comment: ""
+ comments: ""
wiki_content_id: 1
compression: ""
data: |-
diff --git a/test/fixtures/wiki_contents.yml b/test/fixtures/wiki_contents.yml
index ce1c8bd7..1f4ffc36 100644
--- a/test/fixtures/wiki_contents.yml
+++ b/test/fixtures/wiki_contents.yml
@@ -9,4 +9,4 @@ wiki_contents_001:
id: 1
version: 3
author_id: 1
- comment: Gzip compression activated
+ comments: Gzip compression activated
diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb
index 301704a9..c07ee827 100644
--- a/test/unit/comment_test.rb
+++ b/test/unit/comment_test.rb
@@ -26,7 +26,7 @@ class CommentTest < Test::Unit::TestCase
end
def test_create
- comment = Comment.new(:commented => @news, :author => @jsmith, :comment => "my comment")
+ comment = Comment.new(:commented => @news, :author => @jsmith, :comments => "my comment")
assert comment.save
@news.reload
assert_equal 2, @news.comments_count
diff --git a/test/unit/wiki_content_test.rb b/test/unit/wiki_content_test.rb
index a6b714eb..a8c28ae2 100644
--- a/test/unit/wiki_content_test.rb
+++ b/test/unit/wiki_content_test.rb
@@ -27,7 +27,7 @@ class WikiContentTest < Test::Unit::TestCase
def test_create
page = WikiPage.new(:wiki => @wiki, :title => "Page")
- page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comment => "My comment")
+ page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment")
assert page.save
page.reload
@@ -36,7 +36,7 @@ class WikiContentTest < Test::Unit::TestCase
assert_equal 1, content.version
assert_equal 1, content.versions.length
assert_equal "Content text", content.text
- assert_equal "My comment", content.comment
+ assert_equal "My comment", content.comments
assert_equal User.find(1), content.author
assert_equal content.text, content.versions.last.text
end