How do Laravel migrations work?

后端 未结 3 1010
时光取名叫无心
时光取名叫无心 2020-12-16 17:50

I\'m totally new to this type of framework. I\'ve come from barebones PHP development and I can\'t seem to find an easy to understand guide what migrations actually do.

3条回答
  •  别那么骄傲
    2020-12-16 18:41

    Imagine you are working on a project with other developers. As developers are adding more and more features, they are also required to add more and more tables, columns, remove columns, change column data types, etc...

    This can very quickly and easily get out of control. If you missed some SQL from one developer, another developer's SQL may not work correctly. It also potentially becomes a huge time waster trying to sort through a bunch of sql files trying to figure out which ones you've missed. It's only a matter of time till everyone on the development team is working with different databases or god forbid, someone breaks the production database. With migrations, you just need to run php artisan migrate in the command line and all changes to the database will be taken care of for you.

    This is basically why migrations are useful I'm not going to go into the basics of how they work because Kryten has a pretty good write-up here already.

提交回复
热议问题