Large or long-lived applications can have this issue, a huge list of migration files that were created more than a few years ago. These will never change again and are slowing down your tests. How can you improve this?

In Laravel 8, which will be released later this year (somewhere around September 2020), Taylor Otwell added a new feature called "Schema Dump". This creates a dump of the current schema state using mysqldump or pgdump.

Why should you use this? First of all, speed. When you have a lot of different migrations it takes a long to time run all those migrations for the tests. When you only have to execute one file it will save you a lot of setup time.

Also, developers want to have a clear overview of the files, folders, controllers, etc. Why wouldn't you clean up the database migrations that already have been deployed to production? You probably don't want to change them again, especially when it's more than a year ago.

Interested in how this feature works behind the scenes? Check out the pull request on Github via

Robin Dirksen

Robin Dirksen

On my blog, you can find articles that I've found useful or wanted to share with anyone else.

If you want to know more about this article or just want to talk to me, don't hesitate to reach out.