A wrapper package to run mysqldump from laravel console commands.
Install from packagist
composer require yadakhov/laradump
'providers' => [
// ...others
Yadakhov\Laradump\LaradumpServiceProvider::class,
],
php artisan vendor:publish
Once the LaradumpServiceProvider is registered, the commands will show up when you do a php artisan
.
php artisan
...
laradump
laradump:drop-tables Drop tables that do not have backup files.
laradump:list List all tables to perform individually.
laradump:mysqldump Perform a MySQL dump on every tables.
laradump:restore Perform a restore on every tables.
laradump:save-to-s3 Save laradump folder to s3
laradump:sync-from-s3 Sync laradump folder from s3
...
php artisan laradump:mysqldump
Will perform a mysqldump of each table in your database and store it in the storage/dumps
folder.
php artisan laradump:restore
Will load all sql files in /storage/dumps.
php artisan laradump:mysqldump --table=user
php artisan laradump:restore --table=user
# To see a list of possible tables
php artisan laradump:list
# Create the tables for storing the files
mkdir storage/laradump/tables
mkdir storage/laradump/data
sudo chmod o+w -R storage
# add line to your .gitignore
/storage/laradump