Class: RubyLLM::Generators::UpgradeToV19Generator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration, GeneratorHelpers
Defined in:
lib/generators/ruby_llm/upgrade_to_v1_9/upgrade_to_v1_9_generator.rb

Overview

Generator to add v1.9 columns (cached tokens + raw content support) to existing apps.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from GeneratorHelpers

#acts_as_chat_declaration, #acts_as_message_declaration, #acts_as_model_declaration, #acts_as_tool_call_declaration, #create_namespace_modules, #migration_version, #mysql?, #parse_model_mappings, #postgresql?, #table_exists?

Class Method Details

.next_migration_number(dirname) ⇒ Object



21
22
23
# File 'lib/generators/ruby_llm/upgrade_to_v1_9/upgrade_to_v1_9_generator.rb', line 21

def self.next_migration_number(dirname)
  ::ActiveRecord::Generators::Base.next_migration_number(dirname)
end

Instance Method Details

#create_migration_fileObject



25
26
27
28
29
30
31
32
# File 'lib/generators/ruby_llm/upgrade_to_v1_9/upgrade_to_v1_9_generator.rb', line 25

def create_migration_file
  parse_model_mappings

  migration_template 'add_v1_9_message_columns.rb.tt',
                     'db/migrate/add_ruby_llm_v1_9_columns.rb',
                     migration_version: migration_version,
                     message_table_name: message_table_name
end

#show_next_stepsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/generators/ruby_llm/upgrade_to_v1_9/upgrade_to_v1_9_generator.rb', line 34

def show_next_steps
  say_status :success, 'Upgrade prepared!', :green
  say "\n    Next steps:\n    1. Review the generated migration\n    2. Run: rails db:migrate\n    3. Restart your application server\n\n    \u{1F4DA} See the v1.9.0 release notes for details on cached token tracking and raw content support.\n\n  INSTRUCTIONS\nend\n"