Class: Pgbus::Generators::AddJobStatsQueueIndexGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration, MigrationPath
Defined in:
lib/generators/pgbus/add_job_stats_queue_index_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_migration_fileObject



22
23
24
25
# File 'lib/generators/pgbus/add_job_stats_queue_index_generator.rb', line 22

def create_migration_file
  migration_template "add_job_stats_queue_index.rb.erb",
                     File.join(pgbus_migrate_path, "add_pgbus_job_stats_queue_index.rb")
end

#display_post_installObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/generators/pgbus/add_job_stats_queue_index_generator.rb', line 27

def display_post_install
  say ""
  say "Pgbus job stats queue index added!", :green
  say ""
  say "Next steps:"
  say "  1. Run: rails db:migrate#{":#{options[:database]}" if separate_database?}"
  say "  2. The Insights 'latency by queue' aggregation will now use the index"
  say "     instead of sequentially scanning pgbus_job_stats. Install this on"
  say "     heavy-traffic deployments with a large job stats retention window."
  say ""
end