logoalt Hacker News

teaearlgraycoldlast Friday at 7:32 PM3 repliesview on HN

I would say automatic migration generation isn’t a necessary or particularly important part of an ORM. ORMs are there to map your database relational objects to your client language’s objects.


Replies

cjs_aclast Friday at 7:47 PM

I think the person you're replying to is arguing for using some sort of database migration library without using an ORM library. It's the same position I came to recently.

show 1 reply
Tostinolast Friday at 7:49 PM

I'd call it an anti-feature for most long-lived projects that will end up needing migrations through its lifetime.

I go the liquibase route for migrations, and just use the mapping portion of any ORM.

pphyschlast Friday at 8:08 PM

Most(?) devs nowadays are introduced to database migration tools as a DX feature.

"Wow, 1-2 command and my app and database are in sync!"

In reality, migration tools are 100% about data loss prevention.

If you do not care about data loss, updating your schema is trivial, just drop everything and create. Dev environments should be stateless anyways, using separate data "fixtures" when needed.

Data loss itself is a highly nuanced topic. Some data is replaceable, some might be protected in a separate store. So I agree that ORMs should challenge the assumption that automatic migration tools need to be part of their kitchen sink.

show 2 replies