Mercurial > hg > soundsoftware-site
comparison .svn/pristine/14/144d87a484de2d989cccbe9e992e92ab12eacca5.svn-base @ 909:cbb26bc654de redmine-1.3
Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author | Chris Cannam |
---|---|
date | Fri, 24 Feb 2012 19:09:32 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
908:c6c2cbd0afee | 909:cbb26bc654de |
---|---|
1 class PopulateChangesetsUserId < ActiveRecord::Migration | |
2 def self.up | |
3 committers = Changeset.connection.select_values("SELECT DISTINCT committer FROM #{Changeset.table_name}") | |
4 committers.each do |committer| | |
5 next if committer.blank? | |
6 if committer.strip =~ /^([^<]+)(<(.*)>)?$/ | |
7 username, email = $1.strip, $3 | |
8 u = User.find_by_login(username) | |
9 u ||= User.find_by_mail(email) unless email.blank? | |
10 Changeset.update_all("user_id = #{u.id}", ["committer = ?", committer]) unless u.nil? | |
11 end | |
12 end | |
13 end | |
14 | |
15 def self.down | |
16 Changeset.update_all('user_id = NULL') | |
17 end | |
18 end |