Skip to content

Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. 🔥💬

593 B
Raw Blame
class AddRingingIndexToCalls < ActiveRecord::Migration[7.1]
  disable_ddl_transaction!

  # The ring timeout sweep looks for ringing calls older than a cutoff every 30 seconds;
  # almost every call is terminal, so the index covers only the ringing ones. A database
  # that built it under this migration's earlier timestamp keeps it.
  def change
    add_index :calls, [:provider, :created_at],
              where: "status = 'ringing'",
              name: 'index_calls_ringing_on_provider_and_created_at',
              algorithm: :concurrently,
              if_not_exists: true
  end
end