Answer the question
In order to leave comments, you need to log in
How to use migrations in Laravel?
The Laravel documentation says that migrations are a type of version control for the database, but I didn’t really understand how it all works and how to use it correctly.
As far as I understand, migrations help developers maintain a single DB STRUCTURE
For example, one programmer writes a product catalog, the second authorizes . One created fields in the products table, the second created fields in the users table. They did all this through migrations, wrote their own code, pushed it, and went to rest. In the morning, each of them updated the repository, pulled each other's changes, applied migrations, and now both have the same database structure . Everything is more or less clear here.
But what about data?
One programmer yesterday, among other things, created new products in the database, the second new users. They updated the database structures, but each has its own data. One sits with filled goods and empty users, the other vice versa. Some unfinished version control is obtained.
Or does it all happen in some other way?
Answer the question
In order to leave comments, you need to log in
https://github.com/fzaninotto/Faker -- you can generate different data:
Factories in Laravel
An example of generating users through a factory and a faker Populating
10 users through the factory above
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question