The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →php artisan schema:dump --prune writes the current database structure to a SQL file under database/schema and prunes existing migration files. Laravel can then build a new database from that schema file before running later migrations. The workflow is useful only if the right schema files are committed and available for every database connection your team actually uses.
What does php artisan schema:dump --prune do?
Laravel creates a schema file in the application’s database/schema directory. Its filename corresponds to the database connection. With --prune, Laravel also removes the existing migration files represented by the dump. Future migrations are still kept as migration files.
As an Amazon Associate I earn from qualifying purchases.
When Laravel migrates a connection that has no migrations recorded, it loads that connection’s schema file first, then runs migrations that are not included in the dump. In effect, the dump provides a starting point for a clean database; it does not replace migrations created afterward. See the Laravel 10.x migration documentation for the documented workflow.
Do I commit the schema file?
Yes. Laravel’s migration documentation says to commit the schema file so new developers can quickly create the application’s initial database structure. Without the artifact in a fresh checkout, the documented clean-start workflow cannot use that dump.
#1 Best Overall
Before pruning, confirm that the generated file is included in source control and that a clean database can be created from the committed version. Keep the migration files you need for changes made after the dump; pruning is not a reason to omit later migrations from version control.
Why are my tests failing after I prune migrations?
A common configuration mismatch to check is that tests use a different database connection from local development. Laravel’s documentation specifically recommends creating a schema dump for a separate testing connection, giving this example:
php artisan schema:dump --database=testing --prune
Make an inventory of the connections used by developers, automated tests, and CI, then ensure each connection that needs a clean-start schema has its corresponding dump committed. A dump for the default connection does not, by itself, establish that a distinct test connection can be initialized.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →What should the team verify before pruning?
- Clean-install reproducibility: Can a teammate or CI job create the initial database from the committed schema file and apply subsequent migrations?
- Every connection: Are development, testing, and CI configured with the same connection names and schema artifacts expected by the application?
- Driver and client availability: Laravel 10.x documents migration squashing for MySQL, PostgreSQL, and SQLite and says it uses the database’s command-line client. Check the documentation and tooling requirements for the Laravel version actually installed; do not assume the Laravel 10 list applies to every release.
- Historical context: Do developers or maintainers rely on old migration files to understand how the schema evolved? A schema dump captures the current structure, not the sequence of decisions that produced it.
- Deployment coordination: If several servers may run migrations during deployment, Laravel 10.x documents
migrate --isolated, which uses a cache-backed atomic lock. The servers must use a shared central cache. This is a migration execution safeguard, not evidence that schema dumping itself is unsafe.
Does schema dumping work with multiple databases?
Schema files are associated with database connections, so treat each connection as its own setup to verify rather than assuming one dump covers every database. A Laravel Framework issue reports a problem in a particular two-database configuration: Laravel 8.69.0, PHP 8.0.10, and MySQL 5.7, with a secondary database that lacked its own migrations table. The issue page is closed but does not explain the resolution, so it does not establish a defect in current Laravel releases. See Laravel Framework issue #39476 and test the behavior against your installed version and connection configuration.
Rank #3
What if PostgreSQL uses transaction pooling?
Laravel 13’s database documentation describes configuring a direct PostgreSQL connection for migrations, schema dumps, and restores when transaction pooling is in use. If the pooled endpoint cannot perform those operations, verify that the direct connection details and credentials are configured and reachable in the environment that runs them. This guidance is version-specific; consult the documentation for your Laravel release. See Laravel 13 database documentation.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Should your team prune its old migrations?
Pruning is a maintainability choice, not a universal upgrade or performance requirement. It fits best when the team can reliably create clean databases from committed schema dumps, including for separate test connections, and does not need the full migration sequence as its working record. Keeping the files may be preferable when migration history is important for explaining schema changes or when the team cannot yet verify its drivers, command-line clients, database connections, and deployment setup.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




