Laravel - Migrations - Squashing Migrations
As you build your application, you may accumulate more and more migrations over time. This can lead to your
database/migrations directory becoming bloated with potentially hundreds of migrations. If you would like, you may "squash" your migrations into a single SQL file. To get started, execute the
php artisan schema:dump // Dump the current database schema and prune all existing migrations... php artisan schema:dump --prune
When you execute this command, Laravel will write a "schema" file to your application's
database/schema directory. Now, when you attempt to migrate your database and no other migrations have been executed, Laravel will execute the schema file's SQL statements first. After executing the schema file's statements, Laravel will execute any remaining migrations that were not part of the schema dump.
You should commit your database schema file to source control so that other new developers on your team may quickly create your application's initial database structure.
Migration squashing is only available for the MySQL, PostgreSQL, and SQLite databases and utilizes the database's command-line client. Schema dumps may not be restored to in-memory SQLite databases.