Migrate One Database to Another in a Laravel Project


March 12th, 2021


Migrate DB is a package by Andrey Helldar to migrate one database to another in Laravel apps. Configuring two databases in the config/database.php file, you can use the connection name to run the migration:

1php artisan db:migrate \
2 --schema-from=example \
3 --schema-to=example2

The command will perform all migrations on the source and destination databases and transfer records from the first database to the second.

Currently, this package supports the following databases:

  • MySQL
  • PostgreSQL

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

This package was submitted to our Laravel News Links section. Links is a place the community can post packages and tutorials around the Laravel ecosystem. Follow along on Twitter @LaravelLinks

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.