ORM: Prisma or Sequelize?

codarbind

ADEKOLA Abdwahab

Posted on January 25, 2023

ORM: Prisma or Sequelize?

You are considering which ORM to use for your project, as someone who has used both Prisma and Sequelize, I will advise you go for Prisma.

It has everything you need now and might need in the future.

This article would be a growing one, as I would be updating it with more points with time.

  1. Migrations are dumb on Sequelize.

When you make changes to a DB model while working in a different environment, migrations help you to keep track of the changes and apply these changes when you deploy/merge to another environment. This ensures that, for example, a column you just added to dev environment would be added automatically to staging environment if your PR was merged.

With Prisma you just have to issue a few command line commands to update your migration files. The commands may not be more than two. Here are the commands I use on my current project:

npx prisma generate  

npx nx run backend:migrate-dev or npx prisma migrate dev
Enter fullscreen mode Exit fullscreen mode

That is all.

But with Sequelize, it is like you are writing the migration files your self. Sequelize does not pick and create the migration file from the model (and changes to it), this make it error prone and stressful.

💖 💪 🙅 🚩
codarbind
ADEKOLA Abdwahab

Posted on January 25, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related