February 2025. Database on Sequelize. Works, but:
// Sequelize
const user = await User.findOne({ where: { email } })
user.nmae // typo, TypeScript doesn't see it
Models described in JavaScript. Types generate poorly. Migrations manually.
Why Prisma
- schema.prisma - one file, entire database
- Types generate automatically
- Migrations from schema
- TypeScript out of the box
// Prisma
const user = await prisma.user.findUnique({ where: { email } })
user.nmae // compile error
Migration
Day of work. Wrote schema.prisma based on existing tables. Generated client. Replaced Sequelize calls with Prisma. Tests passed.
Longest part - relations between tables. In Sequelize they're scattered across models. In Prisma - one place in the schema.
Result
Less code. Types everywhere. Migrations automatic. IDE suggests fields and relations.
One downside - Prisma Client is heavier. But for a server application that's not a problem.