Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.0] Add Artisan db:wipe command #29620

merged 1 commit into from Aug 20, 2019


Copy link

antonkomarev commented Aug 17, 2019

Resubmitting #29616 because of breaking changes.

This PR adds db:wipe {--database=} {--drop-views} {--drop-types} {--force} Artisan command.

While developing automated migration & backup restoration process I found very useful to have a quick way to drop all the tables, views and types. It prevents database corruption because of foreign keys and allows to implement full backup restoration on application level.

You could say that there is a migrate:reset command. Yes it is, but it's very slow on many migrations amount because it iterates thru the migrations table and executes down method for each migration. But more important thing that down method could be missing if migrations designed to go only up or there is no dropping foreign keys in them. Reset progress will be broken and database became corrupted. You wouldn't be able to run migrate:reset again and you will be forced to drop all tables, views & types directly in database.

To not duplicate functionality I've made migrate:fresh command simpler. Now it just calls db:wipe and then migrate.

Related PRs: #15281
Related Issues: #12805

@antonkomarev antonkomarev changed the title Add Artisan db:wipe command [6.0] Add Artisan db:wipe command Aug 17, 2019
charj approved these changes Aug 19, 2019
Copy link

charj left a comment


@taylorotwell taylorotwell merged commit c26b435 into laravel:6.0 Aug 20, 2019
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
continuous-integration/travis-ci/pr The Travis CI build passed
@antonkomarev antonkomarev deleted the cybercog:add/artisan-db-wipe-command branch Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.