summaryrefslogtreecommitdiffstats
path: root/db/migrate/20101104182107_add_unique_index_on_members.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-16 10:30:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-16 10:30:45 +0000
commit57afa5345eea60c47b4fc44e86f32e73a202d860 (patch)
treee60a1fc76597f4648fff91c80c0abc9be8da18a6 /db/migrate/20101104182107_add_unique_index_on_members.rb
parentd3d62f4ded2a8c8738451e58d81df27a71a6842f (diff)
downloadredmine-57afa5345eea60c47b4fc44e86f32e73a202d860.tar.gz
redmine-57afa5345eea60c47b4fc44e86f32e73a202d860.zip
Don't pass conditions to #delete_all.
git-svn-id: http://svn.redmine.org/redmine/trunk@15675 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate/20101104182107_add_unique_index_on_members.rb')
-rw-r--r--db/migrate/20101104182107_add_unique_index_on_members.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/db/migrate/20101104182107_add_unique_index_on_members.rb b/db/migrate/20101104182107_add_unique_index_on_members.rb
index 14d1585f7..eabdad86b 100644
--- a/db/migrate/20101104182107_add_unique_index_on_members.rb
+++ b/db/migrate/20101104182107_add_unique_index_on_members.rb
@@ -1,7 +1,7 @@
class AddUniqueIndexOnMembers < ActiveRecord::Migration
def self.up
# Clean and reassign MemberRole rows if needed
- MemberRole.delete_all("member_id NOT IN (SELECT id FROM #{Member.table_name})")
+ MemberRole.where("member_id NOT IN (SELECT id FROM #{Member.table_name})").delete_all
MemberRole.update_all("member_id =" +
" (SELECT min(m2.id) FROM #{Member.table_name} m1, #{Member.table_name} m2" +
" WHERE m1.user_id = m2.user_id AND m1.project_id = m2.project_id" +
@@ -9,7 +9,7 @@ class AddUniqueIndexOnMembers < ActiveRecord::Migration
# Remove duplicates
Member.connection.select_values("SELECT m.id FROM #{Member.table_name} m" +
" WHERE m.id > (SELECT min(m1.id) FROM #{Member.table_name} m1 WHERE m1.user_id = m.user_id AND m1.project_id = m.project_id)").each do |i|
- Member.delete_all(["id = ?", i])
+ Member.where(["id = ?", i]).delete_all
end
# Then add a unique index