Skip to content

Commit

Permalink
Merge pull request #1856 from MushroomObserver/nimmo-add-target-index…
Browse files Browse the repository at this point in the history
…-to-comments

Add "login" index to Users table
  • Loading branch information
nimmolo committed Feb 10, 2024
2 parents 83b0061 + c59e48e commit f27959e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions db/migrate/20240126081715_add_login_index_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddLoginIndexToUsers < ActiveRecord::Migration[7.1]
def up
add_index :users, :login, name: :login_index, if_not_exists: true
end

def down
remove_index :users, :login_id, name: :login_index
end
end
1 change: 1 addition & 0 deletions test/models/description_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def test_groups
assert_equal([rolf], desc.admins)
assert_equal([rolf.id], desc.admin_ids)
assert_equal(User.all, desc.writers)
# Must order on :id because of new table index on `login`
assert_equal(User.order(:id).pluck(:id), desc.writer_ids)
assert_equal(User.all, desc.readers)
assert_equal(User.order(:id).pluck(:id), desc.reader_ids)
Expand Down

0 comments on commit f27959e

Please sign in to comment.