mirror of
https://github.com/redmine/redmine.git
synced 2024-09-08 05:41:43 +02:00
![Marius Balteanu](/assets/img/avatar_default.png)
git-svn-id: http://svn.redmine.org/redmine/trunk@21208 e93f8b46-1217-0410-a6f0-8f06a7374b81
13 lines
373 B
Ruby
13 lines
373 B
Ruby
class RemoveOrphanedUserCustomValues < ActiveRecord::Migration[6.1]
|
|
def up
|
|
user_custom_field_ids = CustomField.where(field_format: 'user').ids
|
|
if user_custom_field_ids.any?
|
|
user_ids = Principal.ids
|
|
CustomValue.
|
|
where(custom_field_id: user_custom_field_ids).
|
|
where.not(value: [nil, ''] + user_ids).
|
|
delete_all
|
|
end
|
|
end
|
|
end
|