Reduce SQL queries to find a unsolved recommended RfC

Fixes CODEOCEAN-JQ
This commit is contained in:
Sebastian Serth
2023-03-14 12:58:47 +01:00
parent 939b31967f
commit 417ead3d3f
3 changed files with 36 additions and 4 deletions

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddIndexForRecommendedRfcs < ActiveRecord::Migration[7.0]
def change
add_index :request_for_comments, %i[exercise_id created_at], where: "(NOT solved OR solved IS NULL) AND (question IS NOT NULL AND question <> '')", name: :index_unresolved_recommended_rfcs
end
end