Skip to content

Commit 3aab1ac

Browse files
committed
update order of created date composite indexes
1 parent 0a978ee commit 3aab1ac

4 files changed

+371
-335
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class ReorderCreatedDateCompositeIndexForEventLogs < ActiveRecord::Migration[8.1]
2+
disable_ddl_transaction!
3+
verbose!
4+
5+
def change
6+
remove_index :event_logs, %i[account_id created_date], algorithm: :concurrently
7+
8+
add_index :event_logs, %i[created_date account_id],
9+
order: { created_date: :desc },
10+
algorithm: :concurrently
11+
end
12+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class ReorderCreatedDateCompositeIndexForRequestLogs < ActiveRecord::Migration[8.1]
2+
disable_ddl_transaction!
3+
verbose!
4+
5+
def change
6+
remove_index :request_logs, %i[account_id created_date], algorithm: :concurrently
7+
8+
add_index :request_logs, %i[created_date account_id],
9+
order: { created_date: :desc },
10+
algorithm: :concurrently
11+
end
12+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class ReorderCreatedDateCompositeIndexForMetrics < ActiveRecord::Migration[8.1]
2+
disable_ddl_transaction!
3+
verbose!
4+
5+
def change
6+
remove_index :metrics, %i[account_id created_date], algorithm: :concurrently
7+
8+
add_index :metrics, %i[created_date account_id],
9+
order: { created_date: :desc },
10+
algorithm: :concurrently
11+
end
12+
end

0 commit comments

Comments
 (0)