Skip to content

PortableStudios/laravel-db-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Laravel DB Tools

Laravel's Artisan is great and one of the strengths of the framework is how database agnostic almost everything is. Except database dumps. And imports.

This package attempts to help cover that gap and provides:

php artisan db:export ?--compressed ?--command-only {filename} Export the database to the file given by filename (autogenerated if not provided) using the database native CLI tools (e.g pg_dump ). If pv is installed in the environment, a progress bar will be shown.

php artisan db:import ?--compressed ?--command-only ?--drop {filename} Import the database given by filename using the database native CLI tools (e.g psql). If --drop specified, drops and re-creates the database prior to import. If pv is installed in the environment, a progress bar will be shown.

For both commands, --command-only will echo the command that would be run, but doesn't execute it.

If compressed is specified, uses gzip and gunzip to compress data - useful if you're transporting the output.

If you attempt to run the commands in production, issues a warning and asks for confirmation before continuing.

Currently, only postgres and mySQL adapters are supported. PRs for additional database drivers would be welcome.