Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorJoel Koglin <JoelKoglin@gmail.com>2015-07-22 00:03:26 +0300
committerJoel Koglin <Joel.Koglin@concur.com>2015-08-21 19:36:27 +0300
commit4d2f36118a3b21b6bb4ee702b98d032967ba463a (patch)
treed2e2093d48b7bc5a38a9c3d1ea85ad7a5904c492 /db
parentf5b3bf84ad10a03c58c161e84ef919661c84267c (diff)
Issue #993: Fixed login failure when extern_uid changes
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150817163600_deduplicate_user_identities.rb14
-rw-r--r--db/schema.rb2
2 files changed, 15 insertions, 1 deletions
diff --git a/db/migrate/20150817163600_deduplicate_user_identities.rb b/db/migrate/20150817163600_deduplicate_user_identities.rb
new file mode 100644
index 00000000000..fab669c2905
--- /dev/null
+++ b/db/migrate/20150817163600_deduplicate_user_identities.rb
@@ -0,0 +1,14 @@
+class DeduplicateUserIdentities < ActiveRecord::Migration
+ def change
+ execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;'
+ execute 'CREATE TEMPORARY TABLE tt_migration_DeduplicateUserIdentities AS SELECT id,provider,user_id FROM identities;'
+ execute 'DELETE FROM identities WHERE id NOT IN ( SELECT MIN(id) FROM tt_migration_DeduplicateUserIdentities GROUP BY user_id, provider);'
+ execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;'
+ end
+
+ def down
+ # This is an irreversible migration;
+ # If someone is trying to rollback for other reasons, we should not throw an Exception.
+ # raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index fdf09b3afdb..7a0c92bddcd 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: 20150812080800) do
+ActiveRecord::Schema.define(version: 20150817163600) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"