From ac004297fa708d9fc0bb61be2b01832e06406c8a Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 30 Jan 2019 09:33:53 +0800 Subject: [PATCH] PERF: Add index on `user_id` to `single_sign_on_records`. --- app/models/single_sign_on_record.rb | 1 + ...0013015_add_index_on_user_id_to_single_sign_on_records.rb | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 db/migrate/20190130013015_add_index_on_user_id_to_single_sign_on_records.rb diff --git a/app/models/single_sign_on_record.rb b/app/models/single_sign_on_record.rb index 1ceeacf5d6d..417a5f35902 100644 --- a/app/models/single_sign_on_record.rb +++ b/app/models/single_sign_on_record.rb @@ -24,4 +24,5 @@ end # Indexes # # index_single_sign_on_records_on_external_id (external_id) UNIQUE +# index_single_sign_on_records_on_user_id (user_id) # diff --git a/db/migrate/20190130013015_add_index_on_user_id_to_single_sign_on_records.rb b/db/migrate/20190130013015_add_index_on_user_id_to_single_sign_on_records.rb new file mode 100644 index 00000000000..2eb26d5ca57 --- /dev/null +++ b/db/migrate/20190130013015_add_index_on_user_id_to_single_sign_on_records.rb @@ -0,0 +1,5 @@ +class AddIndexOnUserIdToSingleSignOnRecords < ActiveRecord::Migration[5.2] + def change + add_index :single_sign_on_records, :user_id + end +end