From 48fbce53f7ac7cf65f1b68321fde815f9cd280d6 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Wed, 2 Sep 2015 13:29:58 -0300 Subject: [PATCH] oauth_client: fix migration --- plugins/oauth_client/db/migrate/20150815173209_add_authorization_data_to_oauth_client_user_provider.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/oauth_client/db/migrate/20150815173209_add_authorization_data_to_oauth_client_user_provider.rb b/plugins/oauth_client/db/migrate/20150815173209_add_authorization_data_to_oauth_client_user_provider.rb index 7cf7c5f..4f69697 100644 --- a/plugins/oauth_client/db/migrate/20150815173209_add_authorization_data_to_oauth_client_user_provider.rb +++ b/plugins/oauth_client/db/migrate/20150815173209_add_authorization_data_to_oauth_client_user_provider.rb @@ -12,8 +12,11 @@ class AddAuthorizationDataToOauthClientUserProvider < ActiveRecord::Migration add_column :oauth_client_plugin_auths, :profile_id, :integer OauthClientPlugin::Auth.find_each batch_size: 50 do |auth| - auth.profile = User.find(auth.user_id).person - auth.save! + user = User.find_by_id(auth.user_id) + if user.present? + auth.profile = user.person + auth.save! + end end remove_column :oauth_client_plugin_auths, :user_id -- libgit2 0.21.2