-
-
Notifications
You must be signed in to change notification settings - Fork 352
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Basic checks
- I searched existing issues - this hasn't been reported
- I can reproduce this consistently
- This is a RubyLLM bug, not my application code
What's broken?
I encountered a migration issue when using RubyLLM with a MariaDB/MySQL database.
The current migration uses several t.json columns, but MySQL/MariaDB versions do not fully support this column type (especially MariaDB, where JSON is only an alias for LONGTEXT and may not behave as expected).
Migration:
class CreateModels < ActiveRecord::Migration[7.2]
def change
create_table :models do |t|
t.string :model_id, null: false
t.string :name, null: false
t.string :provider, null: false
t.string :family
t.datetime :model_created_at
t.integer :context_window
t.integer :max_output_tokens
t.date :knowledge_cutoff
t.json :modalities, default: {}, null: false
t.json :capabilities, default: [], null: false
t.json :pricing, default: {}, null: false
t.json :metadata, default: {}, null: false
t.timestamps
t.index [:provider, :model_id], unique: true
t.index :provider
t.index :family
end
# Load models from JSON
say_with_time "Loading models from models.json" do
RubyLLM.models.load_from_json!
Model.save_to_database
end
end
end
When running the migration on MariaDB/MySQL, it fails because these databases do not support t.json
How to reproduce
Run the upgrade generator
rails generate ruby_llm:upgrade_to_v1_9
Run migrations
rails db:migrate
During the migration, the process also fails when executing:
RubyLLM.models.load_from_json!
Model.save_to_database
This step cannot complete due to the JSON column incompatibility in MySQL/MariaDB.
Expected behavior
Either:
- Replace t.json with t.jsonb or t.text for MySQL/MariaDB compatibility, or
- Provide separate migrations depending on the adapter, similar to other gems that support multiple databases.
What actually happened
Migration fails with an error related to an unsupported JSON column type.
Environment
- DB: MariaDB / MySQL
- Rails version: 7.2
- RubyLLM version: 1.9.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working