mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 11:28:18 +00:00
cf21de0e7a
This commit adds an additional find_user_by_email hook to ManagedAuthenticator so that GitHub login can continue to support secondary email addresses
The github_user_infos table will be dropped in a follow-up commit.
This is the last core authenticator to be migrated to ManagedAuthenticator 🎉
30 lines
594 B
Ruby
30 lines
594 B
Ruby
# frozen_string_literal: true
|
|
|
|
class MigrateGithubUserInfos < ActiveRecord::Migration[6.0]
|
|
def up
|
|
execute <<~SQL
|
|
INSERT INTO user_associated_accounts (
|
|
provider_name,
|
|
provider_uid,
|
|
user_id,
|
|
info,
|
|
last_used,
|
|
created_at,
|
|
updated_at
|
|
) SELECT
|
|
'github',
|
|
github_user_id,
|
|
user_id,
|
|
json_build_object('nickname', screen_name),
|
|
updated_at,
|
|
created_at,
|
|
updated_at
|
|
FROM github_user_infos
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|