summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-11-10 23:49:02 +0000
committerGo MAEDA <maeda@farend.jp>2022-11-10 23:49:02 +0000
commit09f6fcd49cdbbecddc944753c197cceb912ef988 (patch)
tree57a6e38f80c52d70067c776f6ae1662ba69a41e3
parentb9379e7a26bce4ba76108da1b6f13ea22e236632 (diff)
downloadredmine-09f6fcd49cdbbecddc944753c197cceb912ef988.tar.gz
redmine-09f6fcd49cdbbecddc944753c197cceb912ef988.zip
Add an index to improve the performance of issue queries involving custom fields (#29171).
Contributed by Stephane Evr. git-svn-id: https://svn.redmine.org/redmine/trunk@21955 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--db/migrate/20221012135202_add_index_to_custom_values.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/db/migrate/20221012135202_add_index_to_custom_values.rb b/db/migrate/20221012135202_add_index_to_custom_values.rb
new file mode 100644
index 000000000..21f5670aa
--- /dev/null
+++ b/db/migrate/20221012135202_add_index_to_custom_values.rb
@@ -0,0 +1,6 @@
+class AddIndexToCustomValues < ActiveRecord::Migration[6.1]
+ def change
+ remove_index :custom_values, column: [:customized_type, :customized_id], name: :custom_values_customized, if_exists: true
+ add_index :custom_values, [:customized_type, :customized_id, :custom_field_id], name: :custom_values_customized_custom_field
+ end
+end