diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-04-13 11:50:00 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-04-13 11:50:00 +0200 |
commit | 8b4705fea6297a23f708c59cbce3c8a3115128c0 (patch) | |
tree | 8c13a7e6649d9a07d6aa751390453760836fa121 | |
parent | f64db1fab95751bc2b1cf04641bb031d6289d16b (diff) | |
download | gitlab-ce-8b4705fea6297a23f708c59cbce3c8a3115128c0.tar.gz |
Make migration work if LDAP is disabled
-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 |