Class: LlmCostTracker::Generators::AsyncIngestionGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/llm_cost_tracker/generators/llm_cost_tracker/async_ingestion_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/async_ingestion_generator.rb', line 16

def create_migration_file
  migration_template(
    "create_llm_cost_tracker_async_ingestion.rb.erb",
    "db/migrate/create_llm_cost_tracker_async_ingestion.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/async_ingestion_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.ingestion = :async
      end

    Without it the async inbox tables stay unused and Tracker keeps writing
    inline. The doctor check warns about unused async ingestion tables.
  MSG
end