discourse/db/migrate/20250925182715_add_index_to_posts_locale.rb
Rafael dos Santos Silva a40149bd1b
PERF: optimize translation progress dashboard with batch query (#34861)
Replace individual per-locale queries with a single query that
calculates completion progress for all locales at once.

This commit also removes methods off the `base_candidate` (used for
Categories and Topics as well) which are not used any more, as the
progress dashboard only shows progress for posts.

t/162846/4

---------

Co-authored-by: Nat <natalie.tay@discourse.org>
2025-09-29 13:32:40 +08:00

13 lines
362 B
Ruby

# frozen_string_literal: true
class AddIndexToPostsLocale < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def up
remove_index :posts, :locale, algorithm: :concurrently, if_exists: true
add_index :posts, :locale, algorithm: :concurrently
end
def down
remove_index :posts, :locale, algorithm: :concurrently, if_exists: true
end
end