fix: add concurrent index creation to reporting events rollup migration

This commit is contained in:
Shivam Mishra
2026-02-11 21:55:21 +05:30
parent 4f53d32924
commit be540a08ec
2 changed files with 7 additions and 4 deletions
@@ -21,7 +21,7 @@
# index_rollup_unique_key (account_id,date,dimension_type,dimension_id,metric) UNIQUE
#
class ReportingEventRollup < ApplicationRecord
class ReportingEventsRollup < ApplicationRecord
belongs_to :account
# Store string values directly in the database for better readability and debugging
@@ -19,16 +19,19 @@ class CreateReportingEventsRollup < ActiveRecord::Migration[7.1]
add_index :reporting_events_rollups,
[:account_id, :date, :dimension_type, :dimension_id, :metric],
unique: true,
name: 'index_rollup_unique_key'
name: 'index_rollup_unique_key',
algorithm: :concurrently
# Query index for timeseries (date range scans)
add_index :reporting_events_rollups,
[:account_id, :metric, :date],
name: 'index_rollup_timeseries'
name: 'index_rollup_timeseries',
algorithm: :concurrently
# Query index for summaries (dimension scans)
add_index :reporting_events_rollups,
[:account_id, :dimension_type, :date],
name: 'index_rollup_summary'
name: 'index_rollup_summary',
algorithm: :concurrently
end
end