Over time any software project will get larger, and with laravel projects this often means that the migrations folder can get very large. In laravel 8 the schema:dump command was introduced to clean this up a bit, and instead of running possibly hundreds of migration files when migrating using migrate:fresh, the schema:dump command can run just 1 schema file containing the schema of all the migrations up until that point. You will need the mysqldump command available as an environment variable as a prerequisite.

First run the schema:dump command: You sh ould now see in /database/schema there is a new file called mysql-schema.sql.

You could run the command again to delete all these unnecessary migration files now: Now you have a new starting point for your migrations, any new migrations will first run the mysql-schema.sql file, and then run all the migrations that came after.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners