diff --git a/app/models/user.rb b/app/models/user.rb index 07a4ca5b267..573c29096a4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2295,6 +2295,7 @@ end # Indexes # # idx_users_admin (id) WHERE admin +# idx_users_ip_address (ip_address) # idx_users_moderator (id) WHERE moderator # index_users_on_last_posted_at (last_posted_at) # index_users_on_last_seen_at (last_seen_at) diff --git a/db/migrate/20241115143259_add_index_to_users_ip_address.rb b/db/migrate/20241115143259_add_index_to_users_ip_address.rb new file mode 100644 index 00000000000..b3731df66b3 --- /dev/null +++ b/db/migrate/20241115143259_add_index_to_users_ip_address.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddIndexToUsersIpAddress < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_index :users, :ip_address, algorithm: :concurrently, name: "idx_users_ip_address" + end +end