diff --git a/db/migrate/20150411000035_fix_identities.rb b/db/migrate/20150411000035_fix_identities.rb index b65ad138b0f512ed56ae63b8bfbf2a06366774a6..e86264b166a7ef6ee2e689ed5e2ad1ee668310fc 100644 --- a/db/migrate/20150411000035_fix_identities.rb +++ b/db/migrate/20150411000035_fix_identities.rb @@ -11,13 +11,13 @@ class FixIdentities < ActiveRecord::Migration # the first LDAP server specified in gitlab.yml / gitlab.rb. new_provider = Gitlab.config.ldap.servers.first.last['provider_name'] - # 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 execute "UPDATE identities SET provider = '#{new_provider}' WHERE provider = 'ldap';" - if defined?(LdapGroupLink) + if table_exists?('ldap_group_links') execute "UPDATE ldap_group_links SET provider = '#{new_provider}' WHERE provider IS NULL;" end end