[DRE-commits] [redmine] 01/07: fix migration when upgrading from wheezy (Closes: #765466)

Antonio Terceiro terceiro at moszumanska.debian.org
Mon Dec 1 00:11:19 UTC 2014


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository redmine.

commit 29f83822dc881c879f28ac3c1b1555a8bc3510c8
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sun Nov 30 18:54:50 2014 -0200

    fix migration when upgrading from wheezy (Closes: #765466)
---
 debian/changelog                     |  2 ++
 debian/patches/drop-update_all.patch | 68 ++++++++++++++++++++++++++++++++++++
 debian/patches/series                |  1 +
 3 files changed, 71 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index f09b3c6..a38a92b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ redmine (3.0~20140825-2) UNRELEASED; urgency=medium
   * debian/redmine.triggers: reconfigure package whenever a plugin is
     installed; so plugins database setup scripts are automatically applied
     when they are installed.
+  * debian/patches/drop-update_all.patch: apply upstream patch to fix upgrades
+    from wheezy (Closes: #765466)
 
  -- Antonio Terceiro <terceiro at debian.org>  Tue, 04 Nov 2014 09:00:37 -0200
 
diff --git a/debian/patches/drop-update_all.patch b/debian/patches/drop-update_all.patch
new file mode 100644
index 0000000..50fa71b
--- /dev/null
+++ b/debian/patches/drop-update_all.patch
@@ -0,0 +1,68 @@
+Description: replace usage of deprecated #update_all method migrations
+Author: Toshi MARUYAMA <marutosijp2 at yahoo.co.jp>
+Origin: upstream
+Bug: http://www.redmine.org/issues/18132
+Bug-Debian: https://bugs.debian.org/765466
+Reviewed-by: Antonio Terceiro <terceiro at debian.org>
+Last-Update: 2014-11-30
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/db/migrate/072_add_enumerations_position.rb
++++ b/db/migrate/072_add_enumerations_position.rb
+@@ -4,7 +4,7 @@ class AddEnumerationsPosition < ActiveRe
+     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
+--- a/db/migrate/078_add_custom_fields_position.rb
++++ b/db/migrate/078_add_custom_fields_position.rb
+@@ -4,7 +4,7 @@ class AddCustomFieldsPosition < ActiveRe
+     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
+--- a/db/migrate/101_populate_changesets_user_id.rb
++++ b/db/migrate/101_populate_changesets_user_id.rb
+@@ -7,7 +7,7 @@ class PopulateChangesetsUserId < ActiveR
+         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
+--- a/db/migrate/20091225164732_remove_enumerations_opt.rb
++++ b/db/migrate/20091225164732_remove_enumerations_opt.rb
+@@ -5,8 +5,8 @@ class RemoveEnumerationsOpt < ActiveReco
+ 
+   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
+--- a/db/migrate/20130215111141_populate_issues_closed_on.rb
++++ b/db/migrate/20130215111141_populate_issues_closed_on.rb
+@@ -15,7 +15,8 @@ class PopulateIssuesClosedOn < ActiveRec
+ 
+       # 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
+ 
diff --git a/debian/patches/series b/debian/patches/series
index b156ff5..55010be 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@
 1001_Parsedate.parsedate.patch
 2020_load_awesome_nested_set.patch
 gemfile-adjustments.patch
+drop-update_all.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/redmine.git



More information about the Pkg-ruby-extras-commits mailing list