Загрузка страницы

New Migrate:Fresh Command (4/14) - Laravel 5.5 New Features

We already have several migration commands and it feels like we get a few new ones with each Laravel release, but I promise that this one is actually worth looking into.

Migrate:fresh works similar to migrate:refresh but with one significant difference. The migrate:refresh command (the command we have had around for a very long time, used to run the down() function for all of our migration files, and then if successfully rolled back everything, it would run the migrations again in the correct order.

This was ok, except when we had an error in our down() functions. This happens for many reasons and not all of them are your fault. For example, sometimes an index can cause the problem, or something a minor typo. But this can be frustrating for developers that can’t successfully reset their database because of some problem in their migration files.

Now with the migrate:fresh command, Laravel simply drops all of the tables as opposed to running the down() functions. This is convenient for us because if you have a problem in the down() function it won’t throw an error. This is also a tad bit faster and over all, it just makes more sense.

I am excited to start working with the migrate:fresh command more and I plan to use it as my “default” command when I want to get a /fresh/ install of my Laravel database tables.

==== MORE FROM THIS SERIES . ====

Full Playlist for the “Laravel 5.5 New Features“ Series:
https://www.youtube.com/playlist?list=PLwAKR305CRO8GY3HVpXShlrXab8Cd7VT_
==== FOLLOW ME ====

Subscribe for New Releases!

Subscribe to DevMarketer Insider
[Email Newsletter]
https://confirmsubscription.com/h/d/5EDC91CF554832D1

Twitter - http://twitter.com/_jacurtis
(ask me questions!)
==== QUESTIONS? ====

Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.

Email me hello@jacurtis.com

Thanks for all your support!

Видео New Migrate:Fresh Command (4/14) - Laravel 5.5 New Features канала DevMarketer
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
12 сентября 2017 г. 4:00:03
00:04:36
Яндекс.Метрика