News for hackers. Stuff that matters.
Re:Ask HN: Raw SQL vs. ORM? by majewsky on Wednesday April 11, 2018 @08:57AM (#16810620)
> What's your preferred approach to store table definitions and migrations?

Schema versioning and ORM can be quite orthogonal, unless your ORM decides to be as opinionated about stuff as e.g. ActiveRecord. In Go, I use migrate [1] and Gorp [2]. Granted, I have to tell the column names to Gorp manually, but that is a minor annoyance which I'm happy to pay for clean separation of concerns.

> Doesn't [using SQL for table definitions and migrations] make them more susceptible to mistakes?

What mistakes do you have in mind? Typos etc. will be caught by tests that access the database. That leaves actual design errors, which can happen just as easily in ORM code as in SQL code.

[1] https://github.com/mattes/migrate

[2] https://github.com/go-gorp/gorp

There are no comments on this comment yet.