-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2592 from ujh/add-missing-indices
Add missing indices as suggested by pg_hero
- Loading branch information
Showing
4 changed files
with
72 additions
and
28 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
db/migrate/20241228202733_add_indices_suggested_by_pg_hero.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class AddIndicesSuggestedByPgHero < ActiveRecord::Migration[8.0] | ||
disable_ddl_transaction! | ||
|
||
def change | ||
add_index :collected_pens, :user_id, algorithm: :concurrently | ||
add_index :collected_pens, | ||
:model, | ||
using: "gist", | ||
opclass: :gist_trgm_ops, | ||
algorithm: :concurrently | ||
add_index :collected_pens, | ||
:brand, | ||
using: "gist", | ||
opclass: :gist_trgm_ops, | ||
algorithm: :concurrently | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
db/migrate/20241228204210_remove_indices_as_suggested_by_pg_hero.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class RemoveIndicesAsSuggestedByPgHero < ActiveRecord::Migration[8.0] | ||
def change | ||
remove_index :collected_inks, | ||
name: "index_collected_inks_on_archived_on", | ||
column: :archived_on | ||
remove_index :gutentag_taggings, | ||
name: | ||
"index_gutentag_taggings_on_taggable_type_and_taggable_id", | ||
column: %i[taggable_type taggable_id] | ||
remove_index :leader_board_rows, | ||
name: "index_leader_board_rows_on_type", | ||
column: :type | ||
remove_index :usage_records, | ||
name: "index_usage_records_on_currently_inked_id", | ||
column: :currently_inked_id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters