Ognjen Regoje bio photo

Ognjen Regoje
But you can call me Oggy


I make things that run on the web (mostly).
More ABOUT me and my PROJECTS.

me@ognjen.io LinkedIn

mysql2 - activerecord version compatibility list

#mysql #rails #technical

In the course of doing upgrades for an older project I’ve discovered that not every activerecord version is compatible with every mysql2 version. The adapters use ~> to lock the gem version as a precaution. Functionally, everything seems fine.

Here’re the versions that work with each other

mysql2 activerecord
0.5.x =5.0.7, >=5.1.6
0.4.x 4.2.5 - 5.0, >=5.0
0.3.x 3.1, 3.2, 4.x, 5.0
0.2.x 2.3 - 3.0

Source

And the mysql2 adapter is here.

Unfortunately, I didn’t have the time to upgrade and test rails, so instead I had to edit that file directly.

If using rvm it’s located at ~/.rvm/gems/ruby-2.1.2@gemset/gems/activerecord-4.1.8/lib/active_record/connection_adapters and simply changing gem 'mysql2', '~> 0.3.13' to gem 'mysql2', '>= 0.3.13' worked.