Class: RubyLLM::Generators::UpgradeToV110Generator

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

Overview

Generator to add v1.10 columns (thinking output + thinking tokens) 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_10/upgrade_to_v1_10_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
33
# File 'lib/generators/ruby_llm/upgrade_to_v1_10/upgrade_to_v1_10_generator.rb', line 25

def create_migration_file
  parse_model_mappings

  migration_template 'add_v1_10_message_columns.rb.tt',
                     'db/migrate/add_ruby_llm_v1_10_columns.rb',
                     migration_version: migration_version,
                     message_table_name: message_table_name,
                     tool_call_table_name: tool_call_table_name
end

#show_next_stepsObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/generators/ruby_llm/upgrade_to_v1_10/upgrade_to_v1_10_generator.rb', line 35

def show_next_steps
  say_status :success, 'Upgrade prepared!', :green
  say <<~INSTRUCTIONS

    Next steps:
    1. Review the generated migration
    2. Run: rails db:migrate
    3. Restart your application server

    📚 See the v1.10.0 release notes for details on extended thinking support.

  INSTRUCTIONS
end