-
-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Index will prevent temp tables if the user is searching for name or file_name. This is necessary if the table becomes bigger.
- Loading branch information
1 parent
415516f
commit 1b83a1e
Showing
3 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
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,6 @@ | ||
class AddIndexesToAlchemyPictures < ActiveRecord::Migration[7.0] | ||
def change | ||
add_index :alchemy_pictures, :name, if_not_exists: true | ||
add_index :alchemy_pictures, :image_file_name, if_not_exists: true | ||
end | ||
end |
6 changes: 6 additions & 0 deletions
6
spec/dummy/db/migrate/20230505132743_add_indexes_to_alchemy_pictures.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,6 @@ | ||
class AddIndexesToAlchemyPictures < ActiveRecord::Migration[7.0] | ||
def change | ||
add_index :alchemy_pictures, :name, if_not_exists: true | ||
add_index :alchemy_pictures, :image_file_name, if_not_exists: true | ||
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