Thoughts on using an ORM?

I wanted to add a blog to my family website and came across Writefreely, but was disappointed to see Postgres isn’t supported so I added it.

I was able to get the basic functionality up and running and so could use it as a blog, but I did eventually come across some features (such as saving custom CSS) that don’t work and can’t easily be patched because they depend on code in the separate writeas/web-core repo.

Unfortunately, my code is generally adding a third dialect check or introducing a new dialect check when one didn’t exist which makes the code more bug prone and harder to maintain.

I’d like to propose rather than trying to make my code mergeable, is there any reason why I can’t introduce an ORM instead?

At first glance, seems like it should work.

Some of the benefits of using an ORM:

  • More readable/maintainable code for programmers that aren’t expert in SQL.
  • No more dialect checks sprinkled throughout the code with opportunities for bugs.
  • ORM will nudge the code towards using idiomatic SQL and database patterns.
  • Low cost support for multiple database dialects.
  • ORM code can be introduced over time while coexisting with direct SQL calls to reduce the risk of migrating.
1 Like