Show of hands -- Who's heard of the "Trilogy" database driver for MySQL?

Github gave us an early Christmas gift earlier this year – back in August they open-sourced their super lean and mean MySQL database driver! This is the same one they have used internally for years, a battle-proven hearty little thing that is sure to benefit the Rails community at large.

With Github always wanting to be cutting-edge, this driver is designed only for the as-of-yet unreleased Rails 7.1. But have no fear – with just a few patches it can run on your existing Rails 6.x app (or even on Rails 5.2 stuff if you’ve been biding your time!)

The only necessary update in order to get all this to work is found in this PR. I’d love to know if it’s worth its salt; if it’s in any way ready for prime time… So if there are any fellow Rubyists out there like me who have spare time over the holidays, and especially if you’ve already got a MySQL app, please give this a “good college try” and let me know how it goes. Just put this in your Gemfile:

gem 'activerecord-trilogy-adapter', git: '',
                                    branch: 'support_rails_6_and_7'

After bundling, and updating your database.yml so the adapter is “trilogy” instead of “mysql2”, it shouild just work. And if it doesn’t then I’d like to know!

Merry Christmas, all!


1 Like

This MySql adapter gem now directly supports Rails 7.0! Just put this in the Gemfile:

gem "trilogy"
gem "activerecord-trilogy-adapter"

And then in database.yml, change mysql2 to trilogy.

(As well, there is a PR to add support for Rails 6.0 and 6.1.)