mdmb
mdmb

Reputation: 5283

Sequelize – migrations vs model definitions

I've switched to Sequelize from Prisma package and I'm wondering about the possible differences in model and migration.

I could define a schema in Prisma and it would automatically generate migrations for me, yet I can't find anything like this in Sequelize.

Do I have to manually define e.g. migration and model files for User? The examples of the migration and model files looks like they are pretty much the same (with some minor differences) when it comes to database fields.

Why do I need the model files? Is this a way of specified how to read the DB?

Upvotes: 0

Views: 174

Answers (1)

Dmytro Mysak
Dmytro Mysak

Reputation: 1252

User sequelize-cli https://www.npmjs.com/package/sequelize-cli

You can generate a model using CLI + it automatically create a migration file for you.

About the model, yes you are right. A Model represents a table in the database.

Upvotes: 1

Related Questions