Class: LlmCostTracker::Generators::CallRollupsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/llm_cost_tracker/generators/llm_cost_tracker/call_rollups_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_migration_fileObject



16
17
18
19
20
21
# File 'lib/llm_cost_tracker/generators/llm_cost_tracker/call_rollups_generator.rb', line 16

def create_migration_file
  migration_template(
    "create_llm_cost_tracker_call_rollups.rb.erb",
    "db/migrate/create_llm_cost_tracker_call_rollups.rb"
  )
end

#warn_about_config_flagObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/llm_cost_tracker/generators/llm_cost_tracker/call_rollups_generator.rb', line 23

def warn_about_config_flag
  say(<<~MSG, :yellow)
    After migrating, set the following in config/initializers/llm_cost_tracker.rb:

      LlmCostTracker.configure do |config|
        config.cache_rollups = true
      end

    Without it Tracker keeps reading budget totals as live SUM aggregates over
    llm_cost_tracker_calls. The doctor check warns about an unused rollups table.
  MSG
end