문제

I'm learning laravel and in most of tutorials they are making migrations using artisan. I skip that step and I'm working directly on a database. I don't know for what can a migration be useful. so the question is: what is exactly a migration?

도움이 되었습니까?

해결책

If you are the lone developer, you may not get much use out of it.

But imagine you have multiple developers each with your app stored locally on their machine. What happens when you need to make an update to the database? You would have to make the update, send the query to each other developer, and they would have to run the query on their machines. Once you get a decent amount of developers making changes to the database, this process can quickly become overwhelming and it's only a matter of time before people start missing the changes.

With migrations, all of the changes are stored as files, so in order for a developer to catch up, all they need to do is fetch the code changes and run php artisan migrate and all the work is done for them. This means all your developers are consistently working with the same database structure.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top