diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-04-11 17:56:45 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-04-11 17:56:45 +0300 |
commit | 8666f497ff13c100f6cd2339971e430dbf05470f (patch) | |
tree | ac54df95998d2f9d67764171ad29255af5d1b532 /db | |
parent | 24d139ba971cf61a4b7a01031c4c57bcba29b172 (diff) | |
download | gitlab-ce-8666f497ff13c100f6cd2339971e430dbf05470f.tar.gz |
fix ldap identities
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20150411000035_fix_identities.rb | 16 | ||||
-rw-r--r-- | db/schema.rb | 6 |
2 files changed, 19 insertions, 3 deletions
diff --git a/db/migrate/20150411000035_fix_identities.rb b/db/migrate/20150411000035_fix_identities.rb new file mode 100644 index 00000000000..12526b10e6e --- /dev/null +++ b/db/migrate/20150411000035_fix_identities.rb @@ -0,0 +1,16 @@ +class FixIdentities < ActiveRecord::Migration + def up + new_provider = Gitlab.config.ldap.servers.first.last['provider_name'] + # Delete duplicate identities + Identity.connection.select_one("DELETE FROM identities WHERE provider = 'ldap' AND user_id IN (SELECT user_id FROM identities WHERE provider = '#{new_provider}')") + # Update legacy identities + Identity.where(provider: 'ldap').update_all(provider: new_provider) + + if defined?(LdapGroupLink) + LdapGroupLink.where('provider IS NULL').update_all(provider: new_provider) + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 14e32a7946e..903ed161e4a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150328132231) do +ActiveRecord::Schema.define(version: 20150411000035) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -336,12 +336,12 @@ ActiveRecord::Schema.define(version: 20150328132231) do t.string "import_url" t.integer "visibility_level", default: 0, null: false t.boolean "archived", default: false, null: false - t.string "avatar" t.string "import_status" t.float "repository_size", default: 0.0 t.integer "star_count", default: 0, null: false t.string "import_type" t.string "import_source" + t.string "avatar" end add_index "projects", ["created_at", "id"], name: "index_projects_on_created_at_and_id", using: :btree @@ -459,6 +459,7 @@ ActiveRecord::Schema.define(version: 20150328132231) do t.integer "notification_level", default: 1, null: false t.datetime "password_expires_at" t.integer "created_by_id" + t.datetime "last_credential_check_at" t.string "avatar" t.string "confirmation_token" t.datetime "confirmed_at" @@ -466,7 +467,6 @@ ActiveRecord::Schema.define(version: 20150328132231) do t.string "unconfirmed_email" t.boolean "hide_no_ssh_key", default: false t.string "website_url", default: "", null: false - t.datetime "last_credential_check_at" t.string "github_access_token" t.string "gitlab_access_token" t.string "notification_email" |