DEV Community

ADEKOLA Abdwahab
ADEKOLA Abdwahab

Posted on

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.

Top comments (2)

Collapse
 
romeopeter profile image
Romeo Agbor Peter • Edited

This article has a great start but tells the reader there's more to it. It'll be great if you complete it 🔥

Collapse
 
bchen profile image
Brian

umm...did you read the docs?