Closed Kareem-Emad closed 2 years ago
Hi, and thanks for the interest!
We do indeed have an Active Record adapter that we'll soon be open-sourcing as a separate project -- we just had to get this low-level library out first. (But note it's likely to require Rails 7.0+ -- older Rails versions are progressively less likely to be supported.)
Is this adapter out yet? Is this all a drop in replacement for mysql2? Does it require Rails7? I searched a bit and couldn't find anything obvious on any of this. Thanks!
The adapter is not out yet, but we are working on it. It currently only supports Rails 7.0+. Trilogy is also still missing some things, like support for prepared statements.
I'm having the same problem on a Rails 7 project
I'm trying to integrate trilogy in a toy project I was working on with
mysql2
without doing a lot of changes. Since I was usingActiveRecord
to write my queries, I thought it would be nice if we could simply replace theadapter
attrribute inconfig/database,yml
frommysql2
to betrilogy
, but it didn't workSo I was wondering if there is a way to add
trilogy
as an ActiveRecord adapter or if such feature could be supported in the future?Process
Rails
5,ruby
2.5,mysql2
gem)rails g model
.trilogy
gem to the gemfile and updated Gemlockbundle update
.config/database.yml
to betrilogy
instead ofmysql2
.rails c
Expected result
Running
Rails c
should work and I can runMyModelName.connection
successfully.Current result
Rails console fails to start