迁移测试用户的高校

dev_aliyun
daiao 5 years ago
parent 758087a5ba
commit 679f0a5d81

@ -0,0 +1,13 @@
class ModifyTestUserForSchool < ActiveRecord::Migration
def up
school_ids = School.pluck(:id)
users = User.where(is_test: true).includes(:user_extensions)
users.find_each do |u|
school_id = school_ids.sample
u.user_extensions.update_column(:school_id, school_id) if u.user_extensions.present?
end
end
def down
end
end
Loading…
Cancel
Save