This blog is part of our Rails 5 series.
MariaDB is an open source fork of the MySQL database and it acts as a drop-in replacement for MySQL.
Some of you might be wondering what advantages MariaDB offers over MySQL.Here is an article which lists 10 reasons to migrate to MariaDB from MySQL.
Active Record support for MariaDB
Accepting that pull request means Rails is committing to supporting MariaDB along with MySQL, PostgreSQL and SQLite.
The tests revealed an issue related to micro-precision support on time column.
If a column has time field and if we search on that column then the search was failing for MariaDB.
In the above case we created a record. However query yielded no record.
Now let’s see why the query did not work for MariaDB.
MariaDB vs MySQL time column difference
First let’s examine the
In the above case column
start is of type
Let’s insert a record in
Now let’s query the table.
In the above case query is passing date part(2000-01-01) along with the time part(12:30:00) for
start and we did not get any result.
Now let’s query again but this time we will pass only the time part to
So in the query if we pass
2000-01-01 12:30:00 to a column which is
time then MariaDB fails.
2000-01-01 12:30:00 to MySQL, PostgreSQL and SQLite will
work fine. That’s because the adapters for those databases will drop the
date part if date is passed in the query string.
In summary Rails 5 officially supports MariaDB and MariaDB can now safely be used as an alternative to MySQL for Ruby on Rails Applications.