Databases (mysql vs postgres)

Does it matter which database you prefer?

All databases have some unique characteristics and capabilities, but they are all pretty equal in the eyes of an ORM like ActiveRecord. In fact, that's one of the selling points of Rails -- you can write once and deploy mostly anywhere. At Penn, we use SQLite for our tests and CI, and Oracle for production and staging. Those could not be more different, yet we don't have to do too much to accommodate their differences.

Walter

IIRC PostgreSQL is the most popular choice among Rails developers but this of course doesn’t mean it’s the right choice for you. You can Google “Postgres vs MySQL” to understand differences between them. My personal preference is PostgreSQL.

Walter, out of curiosity, why different databases? Is this due to licensing reasons? I once led a project where we used SQLite in development and MySQL in production and we were struck by SQLites dynamic typing (i.e. column types aren’t enforced). Is this a problem you need to handle too?

Greg

Our difference is because our CI system runs as an unprivileged user, and our security framework in Oracle (using virtual private databases) requires a real user to work. We have run across some cases where types are not respected, but mostly when using Oracle views as the source of data rather than when using SQLite. We work around these with the attribute framework in Rails 5.1+, and we used to use a helper method in our models before that.

Walter