3 ms·
The reason why people use ORM mappers with their migration functionality is that you get rid of a lot of repetitive stuff and get an okay result for 95%. I hav
by legulere 5y ago
The reason why people use ORM mappers with their migration functionality is that you get rid of a lot of repetitive stuff and get an okay result for 95%.
I have the feeling, if you don’t have a lot of different tables and migrations, writing them by hand probably saves you time compared to learning the intricacies of an ORM mapper (they are usually very leaky abstractions, so you have to read their source code to understand what’s going on).
If you already know an ORM-mapper then it’s usually not worth it.
The real trap seems to be to believe that ORM mappers will abstract the database away and that you don’t need to understand your database anymore.
- halostatue 5y agoYou can get most of the benefit of an ORM mapper with migration functionality from something like this or sqitch (I use sqitch). There are really good reasons to use this over the built-in ORM mapper migrations: - The built-in ORM mapper migrations facility might be an afterthought (I’m looking at you, Sequelize) - You explicitly want to separate database migrations from code changes so that the code needs to be written in such a way that it can run (at reduced functionality if required) with or without the migration, and the presence of the migration should not affect the execution of the code. It’s way too easy with in-built migrations to make a migration that results in downtime. Practicing direct migration with SQL drivers is going to be safer every time.