fedibird-fe/db/migrate/20221230091953_add_personal_timeline_index.rb

12 lines
422 B
Ruby
Raw Normal View History

2022-12-29 08:47:23 +00:00
class AddPersonalTimelineIndex < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def up
safety_assured { add_index :statuses, [:account_id, :id], where: 'visibility = 200 AND deleted_at IS NULL AND reblog_of_id IS NULL', order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_personal_timeline }
end
def down
remove_index :statuses, name: :index_statuses_personal_timeline
end
end