diff options
-rw-r--r-- | db/migrate/20150411000035_fix_identities.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/db/migrate/20150411000035_fix_identities.rb b/db/migrate/20150411000035_fix_identities.rb index b65ad138b0f..297e7eaa5e9 100644 --- a/db/migrate/20150411000035_fix_identities.rb +++ b/db/migrate/20150411000035_fix_identities.rb @@ -9,9 +9,14 @@ class FixIdentities < ActiveRecord::Migration # behavior. Any database references to 'provider: ldap' get rewritten to # whatever the code would have interpreted it as, i.e. as a reference to # the first LDAP server specified in gitlab.yml / gitlab.rb. - new_provider = Gitlab.config.ldap.servers.first.last['provider_name'] + new_provider = if Gitlab.config.ldap.enabled + first_ldap_server = Gitlab.config.ldap.servers.values.first + first_ldap_server['provider_name'] + else + 'ldapmain' + end - # Delete duplicate identities + # Delete duplicate identities execute "DELETE FROM identities WHERE provider = 'ldap' AND user_id IN (SELECT user_id FROM identities WHERE provider = '#{new_provider}')" # Update legacy identities |