larkinwhitaker / laravel-db-backup

Laravel 5 Package for easily backing up and restoring databases with command line tools.
http://keystrokecreative.com/
15 stars 17 forks source link

Add option to purge database before restoring #7

Open rulatir opened 8 years ago

rulatir commented 8 years ago

Please add an option to purge the database before restoring a backup: drop all tables, views, stored procedures etc. but NOT user permissions for the database (i.e. NOT drop database and recreate!).

Rationale: the "backup, migration FAIL, restore" work cycle. Laravel migrations, with their DREADED AND CURSED inability to recover from failures properly, eventually force every laravel programmer to employ some kind of database backup/restore solution so that the database can be backed up before every attempt at artisan migrate and restored when the migration fails due to a stupid coding mistake in the newest migration file. The whole point is to be able to restore the database to the EXACT same state as before the attempted migration. Currently if the migration creates some tables then these tables will still be there after restoring the backup, and a subsequent attempt at migration will fail because those tables already exist. The whole point is to avoid this DREADED AND CURSED scenario.