mirror of
https://github.com/redmine/redmine.git
synced 2025-10-26 00:36:14 +02:00
Use ids instead of pluck(:id) (#32977).
git-svn-id: http://svn.redmine.org/redmine/trunk@21208 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -952,7 +952,7 @@ class User < Principal
|
||||
Watcher.where('user_id = ?', id).delete_all
|
||||
WikiContent.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
|
||||
WikiContentVersion.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
|
||||
user_custom_field_ids = CustomField.where(field_format: 'user').pluck(:id)
|
||||
user_custom_field_ids = CustomField.where(field_format: 'user').ids
|
||||
if user_custom_field_ids.any?
|
||||
CustomValue.where(custom_field_id: user_custom_field_ids, value: self.id.to_s).delete_all
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class RemoveOrphanedUserCustomValues < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
user_custom_field_ids = CustomField.where(field_format: 'user').pluck(:id)
|
||||
user_custom_field_ids = CustomField.where(field_format: 'user').ids
|
||||
if user_custom_field_ids.any?
|
||||
user_ids = Principal.pluck(:id)
|
||||
user_ids = Principal.ids
|
||||
CustomValue.
|
||||
where(custom_field_id: user_custom_field_ids).
|
||||
where.not(value: [nil, ''] + user_ids).
|
||||
|
||||
Reference in New Issue
Block a user