1

I had read and search lot of pages.I don't get it correct explanation what i need.

So,anyone can explain it what it is exactly. It will helpful for most of us.Thanks in advance.

  • Imagine that you have a million records in the database with a column named `email`, but now you want to rename this column to `e-mail`, so you create a migration that will do it for you automatically. Now if someone has an old version of the project, they don't have to check what changed in the database and update everything by hand, migration will do it for them. – Konrad Feb 20 '23 at 13:36

1 Answers1

0

Before explaining what migrations are, you need to understand what Sequelize is. Sequelize is basically a method in which we can create a relational database, and manage it, without the need to be writing SQL queries. It works as a layer between the code we write and the database we interact with. All this is done through a "Model" file where we define an object that represents a DB table, and basically we tell sequelize what data it has and how it is related. Now, the migrations are files where the database tables are previously configured and then created. You can also create the table directly from the model, but it is a good practice to separate the creation of the table on one side, and the model that manages it on the other side. This is what I understand about sequelize and its migrations, and I hope it helps you to understand a little more about this orm.