PERF: Add index to speed up scopes for `UserSecondFactor`.

PERF: Add index to speed up scopes for UserSecondFactor.

diff --git a/db/migrate/20190321072029_add_index_method_enabled_on_user_second_factors.rb b/db/migrate/20190321072029_add_index_method_enabled_on_user_second_factors.rb
new file mode 100644
index 0000000..7224225
--- /dev/null
+++ b/db/migrate/20190321072029_add_index_method_enabled_on_user_second_factors.rb
@@ -0,0 +1,5 @@
+class AddIndexMethodEnabledOnUserSecondFactors < ActiveRecord::Migration[5.2]
+  def change
+    add_index :user_second_factors, [:method, :enabled]
+  end
+end

GitHub sha: 6450969c

2 Likes