From aa3dc9549fc62191d5696a999e072ed2df1db934 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Mon, 3 Jun 2024 11:44:06 -0700 Subject: [PATCH] Add index to `items`.`name` database field I am. Kinda surprised we didn't have this already, huh?? I guess in most searches, the difference isn't very noticeable, because we don't have a lot of item names to sort anyway? But we do this *so often* that I think an index will certainly help! Let's add it! --- db/migrate/20240603181855_add_index_on_name_to_items.rb | 5 +++++ db/schema.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20240603181855_add_index_on_name_to_items.rb diff --git a/db/migrate/20240603181855_add_index_on_name_to_items.rb b/db/migrate/20240603181855_add_index_on_name_to_items.rb new file mode 100644 index 00000000..b3cee2d9 --- /dev/null +++ b/db/migrate/20240603181855_add_index_on_name_to_items.rb @@ -0,0 +1,5 @@ +class AddIndexOnNameToItems < ActiveRecord::Migration[7.1] + def change + add_index :items, :name + end +end diff --git a/db/schema.rb b/db/schema.rb index ff24a46f..c8b17787 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_05_22_233638) do +ActiveRecord::Schema[7.1].define(version: 2024_06_03_181855) do create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t| t.integer "species_id", null: false t.integer "color_id", null: false @@ -140,6 +140,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_05_22_233638) do t.index ["modeling_status_hint", "created_at"], name: "items_modeling_status_hint_and_created_at" t.index ["modeling_status_hint", "id"], name: "items_modeling_status_hint_and_id" t.index ["modeling_status_hint"], name: "items_modeling_status_hint" + t.index ["name"], name: "index_items_on_name" end create_table "login_cookies", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|