You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
405 B
12 lines
405 B
2 years ago
|
namespace :core do
|
||
|
# TODO: Remove once ran on all environments.
|
||
|
desc "Creates a LegacyUser object for any existing Users"
|
||
|
task sync_legacy_users: :environment do
|
||
|
User.where.not(old_user_id: nil).includes(:legacy_users).find_each do |user|
|
||
|
next if user.legacy_users.where(old_user_id: user.old_user_id).any?
|
||
|
|
||
|
user.legacy_users.create!(old_user_id: user.old_user_id)
|
||
|
end
|
||
|
end
|
||
|
end
|