* Add temporary Rake task for creating profile fields * Fix problems after splitting branch * Add profile migration Rake task * Add unique index to profiles * Add migration code to users * Be smarter about updating profiles * Update spec * Update Bullet config * Fix typo * Change temporary rake task to data update script * Re-add profile factory and update spec * Change private declaration to make CodeClimate happy * Update comment * Drop validation in favor of DB default * Update spec
13 lines
344 B
Ruby
13 lines
344 B
Ruby
module DataUpdateScripts
|
|
class MigrateProfileData
|
|
def run
|
|
User.find_each do |user|
|
|
# NOTE: no production users have profiles yet, but we want this script
|
|
# to be idempotent.
|
|
next if user.profile.present?
|
|
|
|
Profile.create(user: user, data: Profiles::ExtractData.call(user))
|
|
end
|
|
end
|
|
end
|
|
end
|