Migrate One Database to Another in a Laravel Project

Packages

March 12th, 2021

mycli-database-featured.png

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:

php artisan db:migrate \
  --schema-from=example \
  --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
  • MSSQL

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.