summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-22 17:37:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-22 17:37:16 +0000
commit2d1866d966d94c688f9cb87c5bf3f096dffac844 (patch)
tree7a733c1cc51448ab69b3f892285305dbfb0ae15e /db
parenta6ec78a4dc658e3517ed682792016b6530458696 (diff)
downloadredmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.tar.gz
redmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.zip
Merged rails-4.1 branch (#14534).
git-svn-id: http://svn.redmine.org/redmine/trunk@13482 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db')
-rw-r--r--db/migrate/001_setup.rb5
-rw-r--r--db/migrate/072_add_enumerations_position.rb2
-rw-r--r--db/migrate/078_add_custom_fields_position.rb2
-rw-r--r--db/migrate/101_populate_changesets_user_id.rb2
-rw-r--r--db/migrate/20091225164732_remove_enumerations_opt.rb6
-rw-r--r--db/migrate/20100819172912_enable_calendar_and_gantt_modules_where_appropriate.rb2
-rw-r--r--db/migrate/20130215111141_populate_issues_closed_on.rb3
7 files changed, 13 insertions, 9 deletions
diff --git a/db/migrate/001_setup.rb b/db/migrate/001_setup.rb
index f1b9c1ed4..3cea13591 100644
--- a/db/migrate/001_setup.rb
+++ b/db/migrate/001_setup.rb
@@ -17,7 +17,10 @@
class Setup < ActiveRecord::Migration
- class User < ActiveRecord::Base; end
+ class User < ActiveRecord::Base
+ attr_protected :id
+ end
+
# model removed
class Permission < ActiveRecord::Base; end
diff --git a/db/migrate/072_add_enumerations_position.rb b/db/migrate/072_add_enumerations_position.rb
index 98092e5cf..cf5646cf9 100644
--- a/db/migrate/072_add_enumerations_position.rb
+++ b/db/migrate/072_add_enumerations_position.rb
@@ -4,7 +4,7 @@ class AddEnumerationsPosition < ActiveRecord::Migration
Enumeration.all.group_by(&:opt).each do |opt, enums|
enums.each_with_index do |enum, i|
# do not call model callbacks
- Enumeration.update_all "position = #{i+1}", {:id => enum.id}
+ Enumeration.where({:id => enum.id}).update_all("position = #{i+1}")
end
end
end
diff --git a/db/migrate/078_add_custom_fields_position.rb b/db/migrate/078_add_custom_fields_position.rb
index cb29098fd..ef940eb02 100644
--- a/db/migrate/078_add_custom_fields_position.rb
+++ b/db/migrate/078_add_custom_fields_position.rb
@@ -4,7 +4,7 @@ class AddCustomFieldsPosition < ActiveRecord::Migration
CustomField.all.group_by(&:type).each do |t, fields|
fields.each_with_index do |field, i|
# do not call model callbacks
- CustomField.update_all "position = #{i+1}", {:id => field.id}
+ CustomField.where({:id => field.id}).update_all("position = #{i+1}")
end
end
end
diff --git a/db/migrate/101_populate_changesets_user_id.rb b/db/migrate/101_populate_changesets_user_id.rb
index dd493d17d..566363f7c 100644
--- a/db/migrate/101_populate_changesets_user_id.rb
+++ b/db/migrate/101_populate_changesets_user_id.rb
@@ -7,7 +7,7 @@ class PopulateChangesetsUserId < ActiveRecord::Migration
username, email = $1.strip, $3
u = User.find_by_login(username)
u ||= User.find_by_mail(email) unless email.blank?
- Changeset.update_all("user_id = #{u.id}", ["committer = ?", committer]) unless u.nil?
+ Changeset.where(["committer = ?", committer]).update_all("user_id = #{u.id}") unless u.nil?
end
end
end
diff --git a/db/migrate/20091225164732_remove_enumerations_opt.rb b/db/migrate/20091225164732_remove_enumerations_opt.rb
index 72c39e05b..2a445dd3a 100644
--- a/db/migrate/20091225164732_remove_enumerations_opt.rb
+++ b/db/migrate/20091225164732_remove_enumerations_opt.rb
@@ -5,8 +5,8 @@ class RemoveEnumerationsOpt < ActiveRecord::Migration
def self.down
add_column :enumerations, :opt, :string, :limit => 4, :default => '', :null => false
- Enumeration.update_all("opt = 'IPRI'", "type = 'IssuePriority'")
- Enumeration.update_all("opt = 'DCAT'", "type = 'DocumentCategory'")
- Enumeration.update_all("opt = 'ACTI'", "type = 'TimeEntryActivity'")
+ Enumeration.where("type = 'IssuePriority'").update_all("opt = 'IPRI'")
+ Enumeration.where("type = 'DocumentCategory'").update_all("opt = 'DCAT'")
+ Enumeration.where("type = 'TimeEntryActivity'").update_all("opt = 'ACTI'")
end
end
diff --git a/db/migrate/20100819172912_enable_calendar_and_gantt_modules_where_appropriate.rb b/db/migrate/20100819172912_enable_calendar_and_gantt_modules_where_appropriate.rb
index 59cd40049..5bee50e3a 100644
--- a/db/migrate/20100819172912_enable_calendar_and_gantt_modules_where_appropriate.rb
+++ b/db/migrate/20100819172912_enable_calendar_and_gantt_modules_where_appropriate.rb
@@ -1,6 +1,6 @@
class EnableCalendarAndGanttModulesWhereAppropriate < ActiveRecord::Migration
def self.up
- EnabledModule.where(:name => 'issue_tracking').all.each do |e|
+ EnabledModule.where(:name => 'issue_tracking').each do |e|
EnabledModule.create(:name => 'calendar', :project_id => e.project_id)
EnabledModule.create(:name => 'gantt', :project_id => e.project_id)
end
diff --git a/db/migrate/20130215111141_populate_issues_closed_on.rb b/db/migrate/20130215111141_populate_issues_closed_on.rb
index b2a828be4..19313d4c8 100644
--- a/db/migrate/20130215111141_populate_issues_closed_on.rb
+++ b/db/migrate/20130215111141_populate_issues_closed_on.rb
@@ -15,7 +15,8 @@ class PopulateIssuesClosedOn < ActiveRecord::Migration
# Then set closed_on for closed issues that weren't up updated by the above UPDATE
# No journal was found so we assume that they were closed on creation
- Issue.update_all "closed_on = created_on", {:status_id => closed_status_ids, :closed_on => nil}
+ Issue.where({:status_id => closed_status_ids, :closed_on => nil}).
+ update_all("closed_on = created_on")
end
end