Mercurial > hg > soundsoftware-site
comparison db/migrate/20090312194159_add_projects_trackers_unique_index.rb @ 1295:622f24f53b42 redmine-2.3
Update to Redmine SVN revision 11972 on 2.3-stable branch
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:02:21 +0100 |
parents | 513646585e45 |
children |
comparison
equal
deleted
inserted
replaced
1294:3e4c3460b6ca | 1295:622f24f53b42 |
---|---|
8 remove_index :projects_trackers, :name => :projects_trackers_unique | 8 remove_index :projects_trackers, :name => :projects_trackers_unique |
9 end | 9 end |
10 | 10 |
11 # Removes duplicates in projects_trackers table | 11 # Removes duplicates in projects_trackers table |
12 def self.remove_duplicates | 12 def self.remove_duplicates |
13 Project.find(:all).each do |project| | 13 Project.all.each do |project| |
14 ids = project.trackers.collect(&:id) | 14 ids = project.trackers.collect(&:id) |
15 unless ids == ids.uniq | 15 unless ids == ids.uniq |
16 project.trackers.clear | 16 project.trackers.clear |
17 project.tracker_ids = ids.uniq | 17 project.tracker_ids = ids.uniq |
18 end | 18 end |