diff options
author | Joel Koglin <JoelKoglin@gmail.com> | 2015-07-22 00:03:26 +0300 |
---|---|---|
committer | Joel Koglin <Joel.Koglin@concur.com> | 2015-08-21 19:36:27 +0300 |
commit | 4d2f36118a3b21b6bb4ee702b98d032967ba463a (patch) | |
tree | d2e2093d48b7bc5a38a9c3d1ea85ad7a5904c492 /db | |
parent | f5b3bf84ad10a03c58c161e84ef919661c84267c (diff) |
Issue #993: Fixed login failure when extern_uid changes
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20150817163600_deduplicate_user_identities.rb | 14 | ||||
-rw-r--r-- | db/schema.rb | 2 |
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" |