Sync your MySQL local database with a remote one.
Use this package to synchronize your local development MySQL database with a remote one (e.g., production). It'll connect through SSH to a remote server, make a dump, download it and import it into your local MySQL database.
- mysql binary (
- GZip (
- mysqldump binary (
- GZip (
- This package only supports MySQL
- It only supports databases hosted on the remote server you provided (local machine > remote machine > dump > local machine)
composer require toyi/sync-database
After updating composer, add the SyncDatabaseProvider to the providers array in
You should publish the
config/sync-database.php config file using
php artisan vendor:publish --provider="Toyi\SyncDatabase\SyncDatabaseProvider".
ssh part will be used to connect to your remote server.
database part will be used to dump the remote database.
Once everything is configured, use
php artisan toyi:sync-database.
Available options :
--tables-no-dataA comma separated list of tables. Only their structure will be dumped (no data)
--no-migrationsDon't execute pending migrations at the end.
The remote database will only be dumped, nothing will ever be written.
The temporary files are deleted once the dump process is over.
However, should something fail, they might persist (and take unecessary disk space). If this is the case, you can delete them yourself (they will be located in the /tmp directory of both the local and remote machines).