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

[8.x] Add --pretend option for model:prune command #38945

Merged
merged 4 commits into from
Sep 24, 2021
Merged

[8.x] Add --pretend option for model:prune command #38945

merged 4 commits into from
Sep 24, 2021

Conversation

shalvah
Copy link
Contributor

@shalvah shalvah commented Sep 24, 2021

This PR adds a --pretend option to model:prune, similar to the one for migrate. As prune is a potentially destructive command (a typo in a query could wipe out the wrong half of your database!), it's helpful to have an extra way to "sanity check" before committing.

The pretend option will print the number of records matching the prunable() query. (I considered printing out the query instead, as migrate's does, but that might be less useful, since it won't take chunking into account and might produce an expensive query.)

If this PR is accepted, I'll go ahead to update the docs.

@taylorotwell taylorotwell merged commit df9ea5d into laravel:8.x Sep 24, 2021
@shalvah shalvah deleted the pretend-prune branch September 24, 2021 18:11
@shalvah
Copy link
Contributor Author

shalvah commented Sep 24, 2021

Thanks; sending in a PR for the docs soon.

victorvilella pushed a commit to cdsistemas/framework that referenced this pull request Oct 12, 2021
* Add --pretend option for model:prune command

* Fix tests

* Fix code style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants